View Full Version : How to add a network folder into python script path

10 October 2010, 05:22 AM
How can i include a network path into Maya's python script path?
i added this into Maya.env:


but dint work. got dis error during import:

import myModule

# Error: No module named myModule
# Traceback (most recent call last):
# File "<maya console>", line 1, in <module>
# ImportError: No module named myModule #

i knw this 'll work for MEL scripts: MAYA_SCRIPT_PATH=\\\\server\\myScripts;

then watz pbm in my line?
plz help.

10 October 2010, 09:58 AM
firstly, I'm fairly sure you need to put 'quotes' around your path strings. secondly you cannot edit the PYTHONPATH while Maya is already running. (well, you can edit it, but it will be ignored ;) )

you either need to modify PYTHONPATH before Maya boots up (e.g. inside maya.env) or use the sys.path.append() command instead.


10 October 2010, 12:51 PM
those things are ok nathan..
btw, is there any mistake in my Maya.env entry, which is:

10 October 2010, 02:51 PM
yeah, you don't need any quotes as it turns out, but you also don't therefore need to escape your backslashes.

PYTHONPATH=\\machineName\myScripts;should be fine, assuming that UNC paths are valid in maya.env?


10 October 2010, 06:25 AM
Solved. This ll work:

Thanks for replies.

10 October 2010, 06:59 AM
One more tip, you can use the site module:

import site

The upshot of this is that if you add it after Python has started up, it will still evaluate .pth files. Which some site-packages use (Pywin for example).

CGTalk Moderation
10 October 2010, 06:59 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.