Help running a python script in batch mode, ImportError

754 views
Skip to first unread message

luiik...@gmail.com

unread,
Jun 29, 2017, 3:47:20 PM6/29/17
to Python Programming for Autodesk Maya
I have been trying to run a maya script in batch mode that readjust pivots in a model that I have using mayapy on the terminal. When running the command below I run into an error saying Import error no module named "maya.standalone". Not too sure what to do.


COMMAND:
mayapy test.py

FILE:
test.py

import maya.standalone
try:
maya.standalone.initialize()
except:
print "standalone already running"

ENV VARIABLES:
alias mayapy='/Applications/Autodesk/maya2017/Maya.app/Contents/bin/mayapy'
export MAYA_LOCATION=/Applications/Autodesk/maya2017/Maya.app/Contents
export PATH=$MAYA_LOCATION/bin:$PATH
export PYHTONPATH=/opt/X11/lib/python2.6/site-packages
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
export PATH

Justin Israel

unread,
Jun 29, 2017, 3:55:32 PM6/29/17
to Python Programming for Autodesk Maya

Can you do this first in your script...

import sys
print sys.path

You shouldn't even have to set those extra Maya env variables in your bash profile since that is what the mayapy bootstrap is supposed to do for you. Somehow you are clearing the PYTHONPATH or PYTHONHOME for the Maya Python process

Justin


--
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/8bae2ef3-5592-4bea-b327-ba0a174fc50b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages