Closed MikeMcR closed 5 years ago
Having the same issues. I find it hard to set up: got an error: AssertionError: Filename C:\Program Files\Autodesk\Maya2019\bin\python27.zip\site.py does not start with any of these prefixes: ['C:\Program Files\Autodesk\Maya2019\Python']
Has someone a video on how to set up for complete beginners?
Having the same issues. I find it hard to set up: got an error: AssertionError: Filename C:\Program Files\Autodesk\Maya2019\bin\python27.zip\site.py does not start with any of these prefixes: ['C:\Program Files\Autodesk\Maya2019\Python']
Has someone a video on how to set up for complete beginners?
I'm a new to this myself. I found the following resources: https://dis-order.net/2018/12/30/rigsys-part-1-2-connect-pycharm-to-maya/ https://youtu.be/DbIx3ds3Y4E
For myself I keep running into the issue, where I run a Python script in PyCharm and I get a "MayaCharm: Connection to Maya refused" I can run this code from inside Maya and then I get the connection.
import maya.cmds as cmds
if not cmds.commandPort(':4434', q=True):
cmds.commandPort(n=':4434')
Is this the correct default behaviour? I'm thinking Maya isn't seeing my
C:\Users\<user>\Documents\maya\scripts\userSetup.py
file (has the same code as above). Perhaps environment variables aren't set correctly? I'm almost done scratching a hole through my head.
I solved my own issue. Here was my solution with the caveat that I'm really new to Python and I don't know what I'm doing (I'm trying to learn).
When I ran the Python commands inside of Maya to open the commandPort
(see previous post), I couldn't connect to PyCharm. The commands were identical to what PyCharm had given me and what I put into my userSetup.py
.
This either meant that Maya wasn't finding my userSetup.py
or it was an it wasn't using it.
After a bit of research it seems that userSetup.py
can be read before the Maya interface has launched and the script is executed before it can be run. I found some discussion and code on Tech-Artists.org about deferring Python code execution until the Maya interface has launched.
So I modified my userSetup.py
and it seems to work (you may need to modify the commandPort
number based on what PyCharm gives you):
import maya
import maya.cmds as cmds
def pycharmConnect(standalone=False):
if not cmds.commandPort(':4434', query=True):
cmds.commandPort(name=':4434')
maya.utils.executeDeferred(pycharmConnect, standalone=True)
When the 3.1.0 update comes out it should reduce alot of confusion about how adding and selecting Maya sdks works and fixes some of the bugs in the settings panel please reopen or start a new issue, if there are still problems after the 3.1.0 update which should be approved and on the plugin repo in a couple of days.
Running Windows 7, PyCharm 2018.3 Community Edition, latest MayaCharm, Maya 2019.2
I put C:\Program Files\Autodesk\Maya2019\bin in my path, restated and launched Maya and PyCharm. In Settings, the MayaCharm window is blank...doesn't show any active Maya SDKs. Path to bin is accurate since I'm able to launch Maya by typing 'maya' into Start\Run in Windows. Other users on YouTube have reported this same issue, specifically with Community Edition.