What is wrong with my MAYA_PYTHON_PATH

Hi. I usually have my scripts organized with the module folder structure so I don’t really use the MAYA_PYTHON_PATH variable when accessing scripts. But I initialized it cause I’m developing a script for a friend of mine and so he don’t have to go ahead and have the same folder structure as me I thought it would be easier if I just shared a folder and he’d append the PYTHON_PATH variable to his maya.env file.

For some reason I can’t seem to access my scripts when doing the usual “import uvUtils.py”
it says “No module named uvUtils”. If I move the script inside one of my module folders it works or inside Maya’s native script folder as in: internalVar -usd
I can execute:
import os
print os.environ[‘MAYA_PYTHON_PATH’]

and it will give me the folder where the script is in. I have installed stand alone Python as well, but I have no environment variables called MAYA_PYTHON_PATH in windows system properties > environment variables so it shouldn’t take precedence over that, right? Or have I misunderstood it.

TLDR:
What could be the cause of my python scripts not being able to run. Returns this error: “No module named uvUtils”.
My python path is added to MAYA_PYTHON_PATH inside maya.env. The rest of my variables inside that file works fine.

So part of the problem is that MAYA_PYTHON_PATH isn’t a defined environment variable for maya.

Instead you’ve conflated PYTHONPATH which is the general environment variable that all python implementations use to prepopulate sys.path, and the MAYA_SCRIPT_PATH environment variable, which is a maya specific variable that pulls weird double-duty between python and mel.

But I’m just not sure what that means. This is what my environment variables look like.

What is there to do about it if anything. How do you have it setup?

Thank you very much for the reply!

EDIT: Oh…I think I understand your explanation now…
I should have used PYTHONPATH…no such thing as MAYA_PYTHON_PATH. Feel so stupid…Now it works…
Thank you!

Glad you got it working.
Sorry I wasn’t more clear.

1 Like