python - 使用 twill 的内置 Mechanize 分布会在 _debug 上引发 AttributeError 吗?

标签 python mechanize twill

我使用 twill (0.9) 并且我还想访问它的内置 Mechanize 分布(在 Python 2.6.6 上)。
我阅读了所有文档,但我不清楚他们是否支持或推荐,如果是,他们肯定不会宣传。
看来你可以这样做:

import _mechanize_dist as mechanize
br = mechanize.Browser()
br.open('http://www.yahoo.com')

然而 Mechanize 在 robotparser._debug 上抛出下面愚蠢的 AttributeError .我不应该尝试使用它吗?或者它只是 Mechanize 的草率异常处理?
(斜纹本身工作正常:twill.commands.go('http://www.yahoo.com'))
Traceback (most recent call last):
  File "<pyshell#19>", line 1, in <module>
    br.open('http://www.yahoo.com')
  File "C:\Dev\Python26\lib\site-packages\twill-0.9-py2.6.egg\twill\other_packages\_mechanize_dist\_mechanize.py", line 212, in open
    return self._mech_open(url, data)
  File "C:\Dev\Python26\lib\site-packages\twill-0.9-py2.6.egg\twill\other_packages\_mechanize_dist\_mechanize.py", line 238, in _mech_open
    response = UserAgentBase.open(self, request, data)
  File "C:\Dev\Python26\lib\site-packages\twill-0.9-py2.6.egg\twill\other_packages\_mechanize_dist\_opener.py", line 175, in open
    req = meth(req)
  File "C:\Dev\Python26\lib\site-packages\twill-0.9-py2.6.egg\twill\other_packages\_mechanize_dist\_http.py", line 440, in http_request
    self.rfp.read()
  File "C:\Dev\Python26\lib\site-packages\twill-0.9-py2.6.egg\twill\other_packages\_mechanize_dist\_http.py", line 387, in read
    robotparser._debug("parse lines")
AttributeError: 'module' object has no attribute '_debug'

(最后一个问题是:我不知道有关同时使用斜纹和 Mechanize 命令的任何警告?)

最佳答案

目前用斜纹布运输的 Mechanize 分布很古老。
最近在twill mailing list上有事件关于升级它。

关于python - 使用 twill 的内置 Mechanize 分布会在 _debug 上引发 AttributeError 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7278103/

相关文章:

python - 使用 Python 中的 Twill 打开链接 : "' module' object has no attribute 'Popen' "What is it?

Python请求模块: Post and go to next page

python - sys.stdin.readlines() 背后是什么

python - 运行时错误: RecursionError: maximum recursion depth exceeded while calling a Python object

请求后 : 'Connection aborted, timeout(' The write operation timed out') 的 Python 错误

php - 使用 PHP 浏览网站

Python Mechanize 文件下载

python - 在工作节点上安装 SPARK 模块

ruby - 如何使用 Mechanize 抓取电子邮件地址而不将 `[email protected]` 作为值

python-3.x - 在 Windows 上的 python 3 上安装斜纹布的问题。