Pages

Thursday 9 June 2011

Getting PyCharm to play nice with mayapy.exe

I've started to get frustrated with wing IDE as it's laking features of late. Eclispe is very good but it's very hard to get into and setup remote debugging. So enter PyCharm. It's actively being developed and has come a long way in a very short period of time.

The 1st thing you will notice is that you can't add mayapy as the interpreter. You have 2 options on windows. If your on Vista or Win 7 the you can add a symbolic file link to mayapy in the bin folder. If your on XP then you can try this .cmd hack to fool PyCharm.

The .cmd trick
Add a file in the maya bin dir called python.cmd

inside the file add the following lines of code

@echo off
mayapy.exe %*

In PyCharm add this python.cmd as the interpreter. This should do the trick. But I have had this fail on occasions.

python.exe sybolic link
open up the cmd console in Vista/Win7. Alter this line to your maya bin dir

cd "C:\Program Files (x86)\Autodesk\Maya2012\bin"

then type

mklink python.exe mayapy.exe

you should have what looks like a shortcut named python.exe in the bin directory. Now in PyCharm you can add this as your python interpreter.

This in my opinion is a bug, after all wings and eclipse don't require this step! but for now, it's all we have.