Finding Maya's User Script Directory

Hello,

I’ve been searching online all day for a command that will tell me what the user script directory is in maya

I have tried

InternalVar -usd 

but it returns the version specific script directory IE.

 C:/Users/<Username>/Documents/maya/2012-x64/scripts/    in windows 

what I am looking for is this directory

C:/Users/<Username>/Documents/maya/scripts/

Any thoughts?

I don’t know about getting that through a variable, but are there situations where

usd = cmds.internalVar(usd=True)
mayascripts = '%s/%s' % (usd.rsplit('/', 3)[0], 'scripts')

wouldn’t be true?

Can you modify that directory to be in a different location relative to the USD? Can you change the USD? (in which case that wouldn’t work anymore)

I’m just spitballing here since I don’t really know.

Take the directory from InternalVar, go to steps up and then descend into ./scripts or make it if it doesn’t exist. If there’s a maya/2012 directory then there sure is (or should be) a maya/scripts directory. Or is there any reason this won’t work for you?

You should also check MAYA_APP_DIR and see if someone re-routed these folders. But the structure of the whole maya folder is usually the same. In the worst case (which I doubt will happen, never happened for us and we have some clients re-routing the maya user folders) just prompt the user.

If you’re trying to look for a location to deploy scripts to, I don’t recommend using the user’s scripts directory. This becomes a trash heap for all kinds of unsavory things. I would add some other directory to Maya’s search path when you launch Maya instead. Almost everyone ends up inventing a “mayalauncher” at some point to manage this, but you can just play with the user’s environment variables as well. For MEL, you want to set MAYA_SCRIPT_PATH, and for the python side, set PYTHONPATH.

http://download.autodesk.com/global/docs/maya2013/en_us/index.html?url=files/Advanced_Changing_the_user_script_locations_with_MEL.htm,topicNumber=d30e716483

++ on that last - user script dir is dangerous, because many mid-level users poke around in there and they can (a) accidentally mess with your stuff, (b) drop in stuff they found on the net that has the same names as your stuff. Not to mention ©, it’s not under source control.

OTOH if you just need to find it, internalVar -uad + “/scripts” is the simplest way to do it

Thank you for the great replies. I got everything running again.