I have a custom django filefield that makes use of sox, a commandline audiotool. This works pretty well as long as i use the django development server. But as soon as i switch to the production server, using apache2 and mod_wsgi, mod_wsgi catches every output to stdout. This makes it impossible to use the commandline tool to evaluate the file, for example use it to check if the uploaded file really is an audio file like this:
filetype=subprocess.Popen([sox,'--i','-t','%s'%self.path], shell=False,\
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(filetype,error)=filetype.communicate()
if error:
raise EnvironmentError((1,'AudioFile error while determining audioformat: %s'%error))
Is there a way to workaround for this?
edit
the error i get is "missing filename". I am using mod_wsgi 2.5, standard with ubuntu 8.04.
edit2
What exactly happens, when i call subprocess.Popen from within django in mod_wsgi? Shouldn't subprocess stdin/stdout be independent from django stdin/stdout? In that case mod_wsgi should not affect programms called via subprocess...
I'm really confused right now, because the file i am trying to access is a temporary file, created via a filenamevariable that i pass to the file creation and the subprocess command. That file is being written to /tmp, where the rights are 777, so it can't be a rights issue. And the error message is not "file does not exist", but "missing filename", which suggests i am not passing a filename as parameter to the commandlinetool.