python - Subprocess is not invoking my command(or is doing it wrong) -
overview:
i have application must make celery- , if simple task such count something- ok.
i' ve got 1 task must convert existing file file using ms windows program. so- installed wine, installed application , added folowing task 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 called nothing happening(there isn't new file anywhere in filesystem)- if i'll call command bash or interactive python shell, ok.
edit: when i'm calling command command line this:
test@ubuntu:~$ xvfb-run -a /home/test/.wine/....exe /r /f 104 /home/test/fs/... err:winediag:x11drv_winegl_initopenglinfo mesa opengl driver using software rendering, 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) 0 events remaining. [here 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 popen command,
print p.communicate() p.wait() print p.communicate()
to see prints stdout
, stderr
, figure out you're doing wrong.
edit: xvfb
fake framebuffer; doesn't have hardware acceleration. try changing wine
settings not require hardware acceleration / not use opengl / software rendering winecfg
.
Comments
Post a Comment