在MacOSX Sierra和XQuartz 2.7.11,Python 2.7下。我能够安装dryscrape及其所需的其他python包。我已经尝试了很多方法来使一些简单的代码工作,但我似乎无法让它工作。这是简单的代码:
#!/usr/bin/python
#coding: utf-8
import dryscrape
testurl = 'http://avi.im/stuff/js-or-no-js.html'
dryscrape.start_xvfb()
session = dryscrape.Session()
session.visit(testurl)
exit()
你可以看到它是一个简单的python脚本文件。它在start_svfb()
或Session()
行都失败了。我可以发布错误等,但是我可以开始讨论我应该设置,运行和测试哪些检查列表以确保X11环境是正确的吗?我是否在OS X终端或XQuartz下运行脚本?我错过了什么?等?
提前致谢,卢卡斯。
这是python的最后一个回溯:
追踪(最近一次通话): 文件" ./ fred.py",第19行,
session = dryscrape.Session()
File "build/bdist.macosx-10.12-intel/egg/dryscrape/session.py", line 22, in __init__
File "build/bdist.macosx-10.12-intel/egg/dryscrape/driver/webkit.py", line 30, in __init__
File "/Library/Python/2.7/site-packages/webkit_server-1.0-py2.7.egg/webkit_server.py", line 230, in __init__
self.conn = connection or ServerConnection()
File "/Library/Python/2.7/site-packages/webkit_server-1.0-py2.7.egg/webkit_server.py", line 507, in __init__
self._sock = (server or get_default_server()).connect()
File "/Library/Python/2.7/site-packages/webkit_server-1.0-py2.7.egg/webkit_server.py", line 450, in get_default_server
_default_server = Server()
File "/Library/Python/2.7/site-packages/webkit_server-1.0-py2.7.egg/webkit_server.py", line 416, in __init__
stderr = subprocess.PIPE)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory