Maya python subprocess error

in python 2.7 i am trying to use this code to get data from Deadline software. It is returning some data from the server ...

import subprocess
path = 'C:/Program Files/Thinkbox/Deadline7/bin/'
p1 = subprocess.Popen([path + 'deadlinecommand.exe', 'pools'], stdout=subprocess.PIPE)
p1.communicate()

      

and see the result:

('none\r\npool_01\r\npool_02\r\npool_03\r\npool_04\r\npool_05\r\npoolhalf\r\n', None)

      

but when i copy this code in python in Maya 2014 i get error:

p1 = subprocess.Popen(['path + 'deadlinecommand.exe', 'pools'], stdout=subprocess.PIPE)
# Error: WindowsError: file C:\PROGRA~1\Autodesk\maya2014\bin\python27.zip\subprocess.py line 826: 6 # 

      

to run this exe file is the only option to delink the connection. but it pays for the stdout data and how to pull it out. subprocess parameters other than what I have not found, but if there are other options they will be happy to try them

has anyone else encountered this problem? strange that in pure Python 2.7 it works in windows everything works and there is no Maya 2014

I use:

Windows 7 + Python 2.7.9

Maya 2014 (Python 2.7.3)

+3


source to share


1 answer


I was just trying something like this a couple of days ago by connecting to Deadline via a command line sender and getting

 # File "C:\Program Files\Autodesk\Maya2013\bin\python26.zip\subprocess.py", line 786, in _make_inheritable
 # WindowsError: [Error 6] The handle is invalid

      

bug in Maya 2013.5. One workaround found here that fixes this issue is to pass all descriptors



p1 = subprocess.Popen([path + 'deadlinecommand.exe', 'pools'], stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE)

      

Hope it helps.

+4


source







All Articles