子进程没有调用我的命令(或者做错了)
概述:
我有一个应用程序,有时必须用芹菜制作一些东西 - 如果是简单的任务,例如计算一些东西 - 一切都可以。
我有一项任务必须使用 MS Windows 程序将现有文件转换为另一个文件。所以-我安装了WINE,然后安装了应用程序并将以下任务添加到我的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
问题:
该命令未被调用或被调用但没有发生任何事情(在任何地方都没有新文件)文件系统) - 但如果我从 bash 或交互式 python shell 调用此命令,一切都会好的。
编辑: 当我从命令行调用命令时,我得到以下信息:
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 remaining.
[Here i must press enter]
test@ubuntu:~$
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 remaining.
[Here i must press enter]
test@ubuntu:~$
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
用于
您的 Popen 命令,然后
查看它打印到
stdout
和stderr
的内容,并找出您做错了什么。编辑:
Xvfb
是一个假帧缓冲区;它没有硬件加速。尝试更改您的wine
设置,使其不需要硬件加速/不使用 OpenGL / 使用winecfg
进行软件渲染。Use
for your Popen command, then
To see what it prints to
stdout
andstderr
and figure out what you're doing wrong.Edit:
Xvfb
is a fake framebuffer; it doesn't have hardware acceleration. Try changing yourwine
settings not to require hardware acceleration / not to use OpenGL / to do software rendering withwinecfg
.