Community
Maya Programming
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya SDK topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Python subprocess//cmd//powershell error

2 REPLIES 2
Reply
Message 1 of 3
c.moreauDZJ6T
724 Views, 2 Replies

Python subprocess//cmd//powershell error

Hi,

 

I'm facing a problem when I try to run a batch file from maya's script editor. For example I'm trying to execute renderman tractor-spool.bat but it seems there is difference between opening a cmd terminal directly from windows, and opening a cmd terminal from Maya. (same thing with powershell) Do you now why?

 

- calling tractor-spool.bat in a cmd window => ask me for a job script. (standard behavior)

- calling tractor-spool.bat from os.system or subprocess => C:\Program Files\Pixar\Tractor-2.3\bin\rmanpy.exe: No module named apps (wrong)

 

Do you know if the way maya is spawning the cmd or powershell window is different from running cmd (win+R cmd) ?

 

Thanks

2 REPLIES 2
Message 2 of 3
lee.dunham
in reply to: c.moreauDZJ6T

This could be due to the environment in which the process was created.

You can pass a dictionary with the desired environment and current directory for the subprocess to run in.

https://docs.python.org/2/library/subprocess.html#popen-constructor

Message 3 of 3
c.moreauDZJ6T
in reply to: lee.dunham

Thanks "lee.dunham" I assume that's the problem, I discover that my script is running perfectly on a "standard" windows machine, but if I'm running the script on the machine I actually using at work for dev purposes with PyCharm/Python3.7/Sublime etc. installed, I'm having the error.

So you're probably right. It requires some digging... ( It works with another user session on my machine as well...)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report