Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
服务器迁移后出现奇怪的python脚本错误_Python - Fatal编程技术网

服务器迁移后出现奇怪的python脚本错误

服务器迁移后出现奇怪的python脚本错误,python,Python,在迁移服务器之前,我的脚本工作正常,但现在它出现了一些我无法修复的错误。这是一台安装了Plesk控制面板的Ubuntu服务器,错误消息如下: ['/usr/bin/xvfb run/usr/bin/wkhtmltoimage','/tmp/tmpdoRlkR/edited.html','/tmp/9300606835df125c28d1288.77555331.png']回溯(最近一次调用):文件“invoice_gen.py”,第140行,在subprocess.call([“/usr/bin

在迁移服务器之前,我的脚本工作正常,但现在它出现了一些我无法修复的错误。这是一台安装了Plesk控制面板的Ubuntu服务器,错误消息如下:


['/usr/bin/xvfb run/usr/bin/wkhtmltoimage','/tmp/tmpdoRlkR/edited.html','/tmp/9300606835df125c28d1288.77555331.png']回溯(最近一次调用):文件“invoice_gen.py”,第140行,在subprocess.call([“/usr/bin/xvfb run/usr/bin/usr/bin/xvfb run/usr/bin/wkhtmltoimage”,htmlfile,args.output])文件“/usr/lib/python2.7/subprocess.py”,第523行,在调用返回Popen(*popenargs,**kwargs).wait()文件“/usr/lib/python2.7/subprocess.py”,第711行,在initerrread,errwrite)文件“/usr/lib/python2.7/subprocess.py”,第1343行,在执行子进程引发子进程异常OSError:[Errno 2]没有这样的文件或目录

看起来您没有在新服务器上安装
/usr/bin/xvfb run

我相信这就是xvfb软件包

如果不起作用,请尝试将命令中的第一个参数“拆分”到两个数组项中。通过
'/usr/bin/xvfb run/usr/bin/wkhtmltoimage'
'/usr/bin/xvfb run'、'/usr/bin/wkhtmltoimage'

所以最后的电话应该是这样的

subprocess.call(["/usr/bin/xvfb-run", "/usr/bin/wkhtmltoimage", htmlfile, args.output])
而不是

subprocess.call(["/usr/bin/xvfb-run /usr/bin/wkhtmltoimage", htmlfile, args.output])
真正的troube解决方案:)
问题在于wkhtmltoimage路径!它被安装到
/usr/local/bin/wkhtmltoimage
而不是
/usr/bin/wkhtmltoimage
,现在它甚至可以在没有xvfb的情况下工作

它已安装并配置为:root@server:~#/usr/bin/xvfb run xvfb run:用法错误:需要命令在虚拟X服务器环境中运行用法:xvfb run[OPTION…]command run命令(通常是X客户端)。选项:-a--auto-servernum尝试获取一个免费的服务器号,从--server numir开始,您可以点击!你的回答给了我一个好主意!非常感谢你。问题在于wkhtmltoimage路径!它被安装到/usr/local/bin/wkhtmltoimage而不是/usr/bin/wkhtmltoimage,现在它甚至可以在没有xvfb的情况下工作!