3

in python 2.7 i try this code to get data from Deadline software. Its return some data from server...

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

and see 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 that code to 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 # 

run this exe file - is the only option dedline communication. but it pays to stdout data and how it is necessary to pull out. subprocess options except I have not found, but if there are other options will be glad to try them

anyone else encountered this problem? strange that in pure Python 2.7 running in windows all works, and there is no Maya 2014

i use:

Windows 7 + Python 2.7.9

Maya 2014 (Python 2.7.3)

Massimo
  • 836
  • 3
  • 17
  • 38
  • maybe I'm missing something but the windows separator is '\' not '/', have you tried with path = 'C:\Program Files\Thinkbox\Deadline7\bin\'? – dnlcrl May 04 '15 at 13:53
  • p1 = subprocess.Popen(['C:\\Program Files\\Thinkbox\\Deadline7\\bin\\deadlinecommand.exe', 'pools'], stdout=subprocess.PIPE) # Error: WindowsError: file C:\PROGRA~1\Autodesk\maya2014\bin\python27.zip\subprocess.py line 826: 6 # – Massimo May 04 '15 at 14:12
  • You have an extra quote in the maya version in front of the variable path - is that in the code:? – theodox May 05 '15 at 17:49

1 Answers1

4

I was just trying something similar couple of days back, connecting to Deadline via the command line submitter 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

error in Maya 2013.5. One workaround found here which does fix this issue is to pipe all the handles

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

Hope it helps.

skar
  • 401
  • 5
  • 15
  • you probably want [`DEVNULL`](http://stackoverflow.com/q/11269575/4279) here instead of `PIPE` otherwise you might hang the subprocess. – jfs May 09 '15 at 17:30
  • @J.F.Sebastian sorry for the late response, Thanks I wasn't aware of DEVNULL I am curious to know the situation in which subprocess may hang(I haven't encountered it so far) can I look it up somewhere? – skar Jan 11 '16 at 20:02
  • There are repeated warnings in the subprocess docs themselves. You could test it with a child process that generates large output and see for yourself. – jfs Jan 13 '16 at 04:11