Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is subprocess throwing OSError here?

I have written my own module, mainly handling a filefield for a django site. After messing around with some things related to mod_wsgi (solved by updating to 3.3), i got my code to run. Right after all the necessary imports, before defining any classes or functions, i test for the availability of sox, an audiocommandlinetool essential to some of my modules functions:

sox = 'path/to/sox'
test=subprocess.Popen([sox,'-h'], shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
error=test.communicate()[1]
if error:
    raise EnvironmentError((1,'Sox not installed properly'),)

This worked fine. Now i have updated ubuntu from 8.04 to 10.04 and the code aborts on the line of the call to subprocess.Popen, throwing the following error message:

File "/usr/lib/python2.6/subprocess.py", line 1139, in _execute_child
    raise child_exception
OSError: [Errno 8] Exec format error  

I already looked for execution rights of sox, i have no other idea where to look for a solution of this. Can subprocess execution rights be limited? Any hints what could be going on here?

like image 843
marue Avatar asked Mar 17 '11 21:03

marue


1 Answers

Try actually executing sox, as the same user that your django wsgi process is running.

It's possible that the binary isn't executable by that user, or that when you upgraded from 8.04 to 10.04, you lost some kernel flag allowing certain binary types to be executed.

like image 153
samurailawngnome Avatar answered Oct 17 '22 13:10

samurailawngnome