Overview:
I have an application that sometimes must make something with celery- and if it is simple task such as count something- everything is ok.
I' ve got one task which must convert existing file to another file using MS Windows program. So- I installed WINE, then installed application and added folowing task to my tasks.py:
def convert_file( fil, to_format = 'pdf', save_to = '/tmp', callback = None ):
devnull = open( '/dev/null', 'w' )
commands = "xvfb-run -a wine '[ABSOLUTE_PATH_TO_WINDOWS_APP]' /r /f 104 %s" % fil
p = subprocess.Popen( commands, shell=True, cwd='/home/test', env=os.environ, stdout = devnull, stderr = subprocess.STDOUT )
p.wait()
devnull.close()
if callback:
subtask( callback ).delay( )
else:
return outfile
Problem:
The command isn't called or is called but nothing is happening(there isn't new file anywhere in filesystem)- but if I'll call this command from bash or from interactive python shell, everything is ok.
Edit: When I'm calling the command from command line I get this:
test@ubuntu:~$ xvfb-run -a /home/test/.wine/....exe /r /f 104 /home/test/fs/...
err:winediag:X11DRV_WineGL_InitOpenglInfo The Mesa OpenGL driver is using software rendering, most likely your OpenGL drivers haven't been installed correctly
test@ubuntu:~$ XIO: fatal IO error 11 (Zasoby chwilowo niedostępne) on X server ":99"
after 1262 requests (1226 known processed) with 0 events 开发者_JAVA技巧remaining.
[Here i must press enter]
test@ubuntu:~$
Use
p = subprocess.Popen( commands, shell=True, cwd='/home/test', env=os.environ, stdout = subprocess.PIPE, stderr = subprocess.PIPE)
for your Popen command, then
print p.communicate()
p.wait()
print p.communicate()
To see what it prints to stdout
and stderr
and figure out what you're doing wrong.
Edit: Xvfb
is a fake framebuffer; it doesn't have hardware acceleration. Try changing your wine
settings not to require hardware acceleration / not to use OpenGL / to do software rendering with winecfg
.
精彩评论