Reputation: 97
I have created a project in my userFolder:
/Users/Goffer/myRig
In my Maya.env, I have added the following lines:
SHARED_MAYA_DIR = HostName:/Users/Goffer
MAYA_SCRIPT_PATH = $SHARED_MAYA_DIR/myRig
In Maya, when I print os.environ['MAYA_SCRIPT_PATH']
I can see my folder as:
HostName:/Users/Goffer/myRig
Then, when I try to import a module:
import myRig.utils.qtUtils
it says:
Error: ImportError: file line 1: No module named myRig.utils.qtUtils
I have an __ init__.py
in each one of my folders.
Am I missing something?
Upvotes: 2
Views: 4908
Reputation: 4777
You may need to check the paths that Python is pointed to in order to see if it sees your directory.
import sys
for path in sys.path:
print path
If your directory is not there you need to add your path to PYTHONPATH
environment variable, since MAYA_SCRIPT_PATH
is for mel scripts (Correct me if I'm wrong!).
You can also check the paths that are in PYTHONPATH
like this.
for path in os.getenv('PYTHONPATH').split(':'): # May need to split with ';' depending on what OS you're in
print path
Upvotes: 1