1

I am trying to open a maya file in maya from my python application on osx.

The problem seems to be that since maya is also python based, and uses its own version of python, when it tries to open in the environment of my python app, it behaves unreliably (random errors, python script editor stops working, doesn't really open the intended maya file, etc etc).

I have tried:

subprocess.Popen(argList, close_fds = True)
=> maya opens with errors

subprocess.Popen(argList, close_fds = True, shell=True)
=> maya opens with errors

environ = os.environ.copy()
environ["PYTHONPATH"] = ""
subprocess.Popen(argList, close_fds = True, shell=True, env=environ)
=> maya just hangs

environ = os.environ.copy()
environ["PYTHONPATH"] = ""
subprocess.Popen(argList, close_fds = True, shell=False, env=environ)
=> maya just hangs

Interestingly, this happens only on osx. On windows everything works with subprocess.Popen(argList, close_fds = True).

What else can I try? How do I get python to open another program without inheriting the environment, i.e., as if I double clicked on the file?

8
  • Are you giving the path to Maya's python as the first argument of arglist? Commented Nov 18, 2015 at 16:06
  • No, the arglist is ["/Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/Maya", "path/to/file.ma"]. Maya is a binary, so cannot be given as an input to maya's python - as far as I know, please correct me if I am wrong. I tried it anyway and it spat out a SyntaxError. Commented Nov 18, 2015 at 18:17
  • 1
    Have you tried ['maya', '-file', 'path/to/file/'] ? You can also pass a snippet of mel to Maya with the -c flag to dump the current environment vars and let you see what the Maya process thinks is going on. Commented Nov 18, 2015 at 19:52
  • Does it work when you just call it from the console? Maybe you need to used open -a AppName on OS X. Commented Nov 19, 2015 at 8:48
  • It works if I did an open from the terminal, but not if I did a system("open...") from within my python app. Commented Nov 20, 2015 at 18:41

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.