MAYA_SCRIPT_PATH being appended in 2018.4

MAYA_SCRIPT_PATH being appended in 2018.4

Anonymous
Not applicable
4,256 Views
19 Replies
Message 1 of 20

MAYA_SCRIPT_PATH being appended in 2018.4

Anonymous
Not applicable

I have set up MAYA_SCRIPT_PATH to point to specific directories in my Maya.env file, the directories include all the defaults up front and my custom paths at the end.

however when I boot Maya up and execute getenv MAYA_SCRIPT_PATH, I see all the stuff I entered in my Maya.env, but with the default folders also appended after my custom paths.

 

ie
in Maya.env:
MAYA_SCRIPT_PATH = ~all of the C:/Program Files/Autodesk/Maya2018/scripts/ default paths separated by ";" and all the C:/Users/.../Documents/maya/ default paths separated by ";" here~; My/Custom/Path/For/Scripts/Here;


upon boot up of maya I type in a script editor
getenv MAYA_SCRIPT_PATH 
I get a return of
~all of the C:/Program Files/Autodesk/Maya2018/scripts/ default paths separated by ";" and all the C:/Users/.../Documents/maya/ default paths separated by ";" here~; My/Custom/Path/For/Scripts/Here;~all of the C:/Program Files/Autodesk/Maya2018/scripts/ default paths separated by ";" and all the C:/Users/.../Documents/maya/ default paths separated by ";" here~

If I delete my entry of MAYA_SCRIPT_PATH =... in Maya.env and reboot maya
getenv MAYA_SCRIPT_PATH
returns
~all of the C:/Program Files/Autodesk/Maya2018/scripts/ default paths separated by ";" and all the C:/Users/.../Documents/maya/ default paths separated by ";" here~

if all I have in my entry of MAYA_SCRIPT_PATH in my Maya.env file is
MAYA_SCRIPT_PATH = ~all of the C:/Program Files/Autodesk/Maya2018/scripts/ default paths separated by ";" and all the C:/Users/.../Documents/maya/ default paths separated by ";" here~;

 

And then boot up Maya and run getenv MAYA_SCRIPT_PATH the default folders are returned twice in a row.

 

What is appending the MAYA_SCRIPT_PATH environment variable?  How do I prevent this from happening? I really need what I put in Maya.env to be the final entry of my MAYA_SCRIPT_PATH environment variable.


0 Likes
4,257 Views
19 Replies
Replies (19)
Message 2 of 20

sean.heasley
Alumni
Alumni

Hi @Anonymous and welcome to the community!

 

Is it possible a line in your script path file is incorrect which is causing this to not point correctly?

 

Also has this worked for you in older versions of Maya and if so what versions?

 

 

0 Likes
Message 3 of 20

Anonymous
Not applicable

Hi Sean, thanks for the warm welcome!

 

The following MAYA_SCRIPT_PATH syntax from my Maya.env has worked for every Maya version from Maya 6.5 through Maya 2016:

MAYA_SCRIPT_PATH = C:/Users/bmoney/Documents/maya/2018/scripts;C:/Users/bmoney/Documents/maya/scripts;C:/Users/bmoney/Documents/maya/2018/presets;C:/Users/bmoney/Documents/maya/2018/prefs/shelves;C:/Users/bmoney/Documents/maya/2018/prefs/markingMenus;C:/Users/bmoney/Documents/maya/2018/prefs/scripts;C:/Program Files/Autodesk/Maya2018/scripts;C:/Program Files/Autodesk/Maya2018/scripts/startup;C:/Program Files/Autodesk/Maya2018/scripts/shelves;C:/Program Files/Autodesk/Maya2018/scripts/others;C:/Program Files/Autodesk/Maya2018/scripts/AETemplates;C:/Program Files/Autodesk/Maya2018/scripts/unsupported;C:/Program Files/Autodesk/Maya2018/scripts/paintEffects;C:/Program Files/Autodesk/Maya2018/scripts/fluidEffects;C:/Program Files/Autodesk/Maya2018/scripts/hair;C:/Program Files/Autodesk/Maya2018/scripts/cloth;C:/Program Files/Autodesk/Maya2018/scripts/live;C:/Program Files/Autodesk/Maya2018/scripts/fur;C:/Program Files/Autodesk/Maya2018/scripts/muscle;C:/Program Files/Autodesk/Maya2018/scripts/turtle;C:/Program Files/Autodesk/Maya2018/scripts/FBX;C:/Program Files/Autodesk/Maya2018/scripts/mayaHIK;C:/Program Files/Autodesk/Maya2018/plug-ins/ATF/scripts;C:/Program Files/Autodesk/Bifrost/Maya2018/scripts/boss;C:/Program Files/Autodesk/Bifrost/Maya2018/scripts/presets;C:/Program Files/Autodesk/Bifrost/Maya2018/scripts;C:/Program Files/Autodesk/Maya2018/plug-ins/MASH/scripts;C:/Program Files/Autodesk/Maya2018/plug-ins/fbx/scripts;C:/Program Files/Autodesk/Maya2018/plug-ins/camd/scripts;C:/solidangle/mtoadeploy/2018/scripts;C:/Program Files/Autodesk/Maya2018/plug-ins/camd/scripts;C:/Program Files/Autodesk/Maya2018/plug-ins/camd/scripts;C:/Program Files/Autodesk/Maya2018/plug-ins/substance/scripts;C:/Program Files/Autodesk/Maya2018/plug-ins/xgen/scripts;C:/solidangle/mtoadeploy/2018/scripts/mtoa/mel;C:/Users/bmoney/Documents/maya/2018/scripts/Mel;Z:/pipeline/tools/maya/mel;

 

The only thing different going on at my current studio than others is that our scripts will be held on a network drive rather than locally copied from a server via versioning software like Perforce.

 

 

 

 

 

0 Likes
Message 4 of 20

sean.heasley
Alumni
Alumni

Hi @Anonymous

 

Thanks for the detailed post!

 

My initial guess is that due to changes that have occurred since 2016 to 2018 that there may be something off in the default scripts and/or how Maya looks for the file paths which would explain why this has worked for you fine in the past but not with 2018.

 

That said, I'm passing your question as well as the syntax blurb to our QA and development team to see if they can diagnose why this isn't working.

 

I'll be sure to update here as soon as I hear back from them!

 

 

Message 5 of 20

Anonymous
Not applicable

Thank you, I look forward to finding out why this is happening.

0 Likes
Message 6 of 20

sean.heasley
Alumni
Alumni

Hi @Anonymous

 

A co-worker got back to me with this:

 

"With my Maya 2018 Update3, it works.

I just installed Maya 2018.3 and most of the plug-ins are unloaded. I’m not sure but it’s likely happening that one of the plug-ins are affecting the env path setup."

 

So it sounds like a plugin is what's causing the issue.

 

Here's a link to download their Maya.env file if you want to take a look at it and compare it to yours.

 

 

0 Likes
Message 7 of 20

Anonymous
Not applicable

Thanks for the reply, although I would really prefer not to downgrade from 2018.4 I will bring that up with the rest of my team. His Maya.env is identical to what I put up though...

 

I did notice that some of the plug-ins that come with maya will load even after un-checking them and their auto-load feature in the plug-ins manager window, which is very unusual. More often than not that comes from a user script which loads said plug-ins, but even when I remove our custom paths from anything Maya looks at and make sure I have a fresh install of Maya, those plugins persist.

At first I thought it was PyMel, since there are a couple places in it that appends things to environment path variables, and it spits out information about loading custom settings for each of those persistent plug-ins, but even when working around PyMel, those plugins persist and MAYA_SCRIPT_PATH gets appended.

-Update... looks like all my path variables are getting appended, any *PATH I put in Maya.env will be appended with default paths, even if it's just default paths.

 

 

0 Likes
Message 8 of 20

sean.heasley
Alumni
Alumni

Hi @Anonymous

 

I understand rolling back may not be ideal. What you could try is rolling back on one machine just to see if that helps and/or we just released Update 5 and it's possible that they may work with that version.

 

 

0 Likes
Message 9 of 20

sean.heasley
Alumni
Alumni

Hi @Anonymous

 

Just wanted to check in to see how things were going. Are you still having this issue?

 

If your issue is resolved, please click Accept as Solution on the posts that helped you so others in the community can find them easily.

 

 

0 Likes
Message 10 of 20

Anonymous
Not applicable

Sorry, we got hit with a ton of production work and was unable to chase this down last week. 

0 Likes
Message 11 of 20

sean.heasley
Alumni
Alumni

Hi @Anonymous

 

No problem! I'll keep an eye on this thread and check in with you at the end of the week unless you get back to me before then!

 

 

0 Likes
Message 12 of 20

Anonymous
Not applicable

I don't suppose .5 was tested to fix appending environment path variables even if paths that are being appended were already in the environment path variable?

 

I was able to ensure my custom paths were appended at the end by adding them to os.environ['MAYA_SCRIPT_PATH'] in userSetup.py
however it doesn't seem to fix the core issue I am seeing which sent me investigating this in the first place. I'll probably have to start a different thread.

0 Likes
Message 13 of 20

sean.heasley
Alumni
Alumni

Hi @Anonymous

 

It's possible that update 5 could help with this but I wouldn't guarantee anything since this is such a niche issue I'm not sure if a fix would have been implemented especially since its seems to be one of the plugins that is affecting the env path set up.

 

 

Message 14 of 20

Anonymous
Not applicable

Found .... an issue/workaround...
the shotgun toolkit was to blame for my woes, and the key to my success. Thank you for looking into this and your work and time on this. I'll mark this as accepted solution.

Message 15 of 20

sean.heasley
Alumni
Alumni

Hi @Anonymous

 

Glad you're up and running!

 

If you wouldn't mind, could you explain how shotgun was causing the issue? I could pass your problem along to the shotgun team so they have it on their radar.

 

 

Message 16 of 20

Anonymous
Not applicable

I think we have a default setup from a while back done for Shotgun Desktop.

If I tried starting Maya outside of shotgun, it was still trying to load and run its scripts (even though its plug-in was no longer in the MAYA_PLUG_IN_PATH), and then force load some built-in Maya plugins which appends things to MAYA_SCRIPT_PATH. That's how those particular plugins were constantly being loaded on boot up even though I unchecked them in Maya's plug-in manager. When I boot up within Shotgun Desktop, the mel scripts I was expecting to be loaded, are loaded fine-ish, however it does obliterate my PYTHONPATH.

If you want to pass anything on to them, and I'll be sure to follow up with them myself as well... it's that any edits to any paths should be checked against what is already setup and only appended if something they need isn't already there (or pre-pended).

Message 17 of 20

Anonymous
Not applicable

I have to reopen this bug.. sorry. Turns out that it was not Shotgun trying to force load the modeling toolkit plugin, it is in fact Maya not respecting plug-in prefs, which force loads the modeling toolkit plugin.. and the paths are being appended by the modeling toolkit plugin (or the plugins it also force loads, which further disregards pluginPrefs.mel).

 

The reason behind me thinking this was a Shotgun issue is a separate maya issue where a workspace json file that was auto-saved with a Shotgun Panel open and on subsequent boot ups of maya, maya prints an error that shotgun isn't loaded and can't find the panel... (the reason i claim this is also a maya issue is that maya throws this error up even if shotgun is being loaded... looks like the workspace json file is being called and any custom UI is trying to be built before maya boots all the way up).
I had Shotgun support looking at this and they were also running into this bug when they disabled all their plug-ins, cleared their maya cache directories, and booted maya outside of Shotgun Desktop.

 

Also using a userSetup.py or userSetup.mel would not be a viable work around as those are executed before the modeling toolkit plug-in is force loaded by maya, wherein paths are being appended and not respected in it or other plug-ins that modeling toolkit force loads. This does happen on 2018, 2018.4, and 2018.5.

Steps to reproduce pathing bug from a fresh install of maya:

  1. boot up maya
  2. get a return of maya's paths via python or mel:
    • Python: 
      • import os
      • msp = os.environ['MAYA_SCRIPT_PATH']
      • for pth in msp.split(';'):
      •          print pth
    • MEL:
      • string $tmpTkn[];
      • tokenize `getenv "MAYA_SCRIPT_PATH"` ";" $tmpTkn;
      • print $tmpTkn;
  3. copy the contents of MAYA_SCRIPT_PATH and add them (separated by ";") to the entry in Maya.env, MAYA_SCRIPT_PATH =
    (you might want to add a path entry that stands out so you can easily find it at the end of your entries)
  4. close Maya
  5. save Maya.env
  6. reboot maya
  7. repeat step 2 and notice that the paths are being appended by the same paths.

 

Steps to reproduce modeling toolkit persistent plugin bug of a fresh install of maya (2018, 2018.4, 2018.5):

  1. boot up maya
  2. go to Windows > Settings and Preferences > Plug-in Manager
  3. disable all "auto-load" plug-ins
    (as a bonus you can try to unload the plug-ins, but you will get the warning about modeling toolkit being unable to be dynamically unloaded)
  4. Go to File - Save Preferences
  5. close maya
  6. open C:\Users\[username]\Documents\maya\[version]\prefs\pluginPrefs.mel and delete ALL lines that autoload a plug-in (ie: evalDeferred("autoLoadPlugin(\"\", \"modelingToolkit\", \"modelingToolkit\")"); )
  7. save pluginPrefs.mel
  8. repeat steps 1 & 2 and note that some plug-ins are still loading.

Steps to see when these plug-ins are being force loaded:

  1. open maya
  2. open the Script Editor
  3. in the Script Editor Window enable History > Echo All Commands
  4. do steps 2-7 for steps to reproduce modeling toolkit persistent plugin bug
  5. open (or create if it doesn't exist) C:\Users\[username\Documents\maya\[version]\scripts\userSetup.mel
  6. type a line of MEL script that has an output ( ie: print "This is where my personal stuff used to start up at the end of maya's boot sequence to ensure my scripts were the last to be sourced!!\n"; )
    -- you can create a userSetup.py in the appropriate PYTHONPATH, but its output will happen on the maya output window and I presume that executes before userSetup.mel.
  7. repeat steps 1 & 2 and look for a line that says "autoLoadPlugin("", "modelingToolkit", "modelingToolkit");" and note that it loads after whatever you have set up in userSetup.mel/py.
      -- bonus info: If you have any plug-ins set to autoload (including modelingToolkit) in your pluginPrefs.mel file, those plugins get auto loaded towards the end of your boot sequence

Somewhere, modeling toolkit is being force loaded before maya looks at your preferences. That's fine, if it's now required, I don't mind... I'm only slightly annoyed that modeling toolkit force loads other plug-ins, I'm a bit frustrated that one of those plug-ins force loads PyMel.. but whatever is appending paths should absolutely (and used to) happen before Maya.env is read, and whatever is sourcing scripts like dagMenuProc.mel using its explicit default maya path, should (and used to) happen before userSetup.mel/py are executed.. sure, load the stuff in our pluginPrefs.mel after userSetup.mel.. that's on us to manage. But the way it boots those up and appends things now, completely ruins what made maya love-able, it's ability to be customized at boot up so we don't have to have our artists and animators manually run a series of scripts or functions before they can work.

 

0 Likes
Message 18 of 20

sean.heasley
Alumni
Alumni

Hi @Anonymous 

 

Thanks for the update although I'm sorry to hear you're still having problems.

 

I added all of this information to the ticket with our development and QA team so they can look into this more with your new information.

 

 

0 Likes
Message 19 of 20

Anonymous
Not applicable

Any movement on this?

0 Likes
Message 20 of 20

sean.heasley
Alumni
Alumni

Hi @Anonymous 

 

At the moment no. I only updated the log a few weeks ago with your new info so they're still working on the fix. It will most likely come with an update to 2018 and/or 2019.

 

 

0 Likes