Search code examples
pythonpyqtmaya

Maya python launch


so I am trying to launch Maya using Python 2.7 as subprocess. My goal for now is to fire it up and hand over some variables.

Launching is working, but it does throw errors I do not have when launching via a bat file.

The process is currently Windows 10 only and I am using Maya 2018 latest update.

Seems like PyQT is not getting loaded this way:

Autodesk/Maya2018/scripts/startup/initMainWindow.mel line 178:
ImportError:
file ######\Maya2018\Python\lib\site-packages\maya\app\general\mayaMixin.py line 35:
DLL load failed: The specified module could not be found., No module named PyQt4.QtCore //

I tried launching using os.system as well as subprocess.Popen both resulting in the same error. My current launch command is a simple call to the exe with no additional parameters.

Do I maybe have to source PyQt myself if run via python call?

command used is:

subprocess.Popen([r"C:/Program Files/Autodesk/Maya2018/bin/maya.exe"])

Thanks

Thomas


Solution

  • Solution: Calling the .exe seems to set all needed PYTHONPATH options needed for Maya to run. This is not the case when calling it from Python. Manually adding it to the PYTHONPATH before executing solves the issue.