问题
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?
来源:https://stackoverflow.com/questions/33784665/subprocess-a-program-using-another-version-of-python