How to get Maya installed location in python

How to get Maya installed location in python

ljc091111
Explorer Explorer
1,999 Views
2 Replies
Message 1 of 3

How to get Maya installed location in python

ljc091111
Explorer
Explorer
In windows, I use  "os.environ", but there is no maya location. Dose anyone konws?
0 Likes
2,000 Views
2 Replies
Replies (2)
Message 2 of 3

brentmc
Autodesk
Autodesk

Hi,

 

Are you saying this doesn't work?

mayaLocation = os.environ['MAYA_LOCATION']

 

Brent McPherson
Principle Software Developer
0 Likes
Message 3 of 3

Stephen.Blair
Community Manager
Community Manager

Where are you running this Python? In Maya? Because MAYA_LOCATION is set by Maya when Maya starts up.
If you try to get MAYA_LOCATION from outside the Maya process, you won't get anything.

In that case, check HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\Maya\2022\Setup\InstallPath



// Stephen Blair
// Arnold Renderer Support
0 Likes