winteralfs
winteralfs

Reputation: 519

I am having trouble getting a python script to run when Maya launches

I am trying to run a python script when Maya(2018) is launched on my Mac. I tried creating a file called 'userSetup.py' and placing it in my '/Users/Shared/Autodesk/maya/2018/scripts' directory.

right now the 'userSetup.py' script just has one line:

print 'its working'

so far, I am not able to get the print message to show up in the script editor when I launch Maya(2018).

google, Autodesk website

Upvotes: 0

Views: 1800

Answers (2)

OutofRhythm
OutofRhythm

Reputation: 21

Try this:

from Maya import cmds

print ('its working')

Upvotes: 0

gdas
gdas

Reputation: 126

Maya usually searches for userSetup.py in the paths defined in PYTHONPATH environment variable. By default $HOME/maya/2018/prefs/scripts directory is added to PYTHONPATHwhen Maya starts. Unless until you are not defining your own PYTHONPATH variable, you can put your userSetup.py in this directory to work with Maya.

Also most of the time you can find the print or log statements(basically stdout) from the userSetup.py files in the terminal(from where Maya is launched) instead of the Maya Script editor.

Upvotes: 1

Related Questions