mayapy missing PYTHONPATH

338 views
Skip to first unread message

Brennan Chapman

unread,
May 25, 2014, 12:05:04 PM5/25/14
to python_in...@googlegroups.com
I’m having some trouble with mayapy not loading the PYTHONPATH.
When using Maya’s GUI, the PYTHONPATH is set when a maya module file is loaded.
By default, if a module path contains a folder titled ‘scripts’, it will be added to the PYTHONPATH.

However, this is not the case when using mayapy. I’ve tried this on mac, windows and linux.
I’m facing problems with arnold not being able to load properly because the PYTHONPATH doesn’t not contain arnolds ‘scripts’ folder.
I know I can manually set the PYTHONPATH, but I'm hoping there is a simple solution that would allow maya to automatically populate it just as it does when loading the GUI.
Any ideas?

Thanks,
Brennan


Paul Molodowitch

unread,
May 25, 2014, 12:12:12 PM5/25/14
to python_inside_maya
The startup process for GUI + mayapy differs slightly, unfortunately - offhand, I can't remember if the handling of modules + PYTHONPATH is one of them, but I'll take your word for it.  I know that pymel makes an effort to keep the startup process in mayapy as similar as possible to GUI maya, so you can try doing this, to start maya:

import pymel.core as pm

...instead of the "standard":

import maya.standalone
maya.standalone.initialize()


If pymel finds that maya hasn't been started when pymel.core is being imported, it will automatically run standalone.initialize(), but will do so in a way that more closely mirrors the way that GUI startup works.  Note that this will only work if you haven't already started / initialized maya.  Give it a shot (even if you don't intend to use pymel itself)...




--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/7A8C167D-D50E-43DB-B624-8582851B7188%40moonbotstudios.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages