0

在 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()它在 the或Session()line上失败。我可以发布错误等,但我可以开始讨论我应该设置、运行和测试什么检查列表以确保 X11 环境是正确的吗?我是在 OS X 终端还是 XQuartz 下运行脚本?我错过了什么?ETC。?

在此先感谢,卢卡斯。

这是python的最后一个回溯:

Traceback(最近一次调用最后一次):文件“./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
4

0 回答 0