Python/Mechanize - 无法选择表单 - ParseError(exc)

标签 python mechanize

我收到此错误:

>>> br = Browser()
>>> br.open("http://www.bestforumz.com/forum/")
<response_seek_wrapper at 0x21f9fd0
whose wrapped object =
<closeable_response at 0x21f9558 whose
fp = <socket._fileobject object at
0x021F5F30>>>
>>> br.select_form(nr=0)

Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    br.select_form(nr=0)
  File "build\bdist.win32\egg\mechanize\_mechanize.py", line 505, in select_form
    global_form = self._factory.global_form
  File "build\bdist.win32\egg\mechanize\_html.py", line 546, in __getattr__
    self.forms()
  File "build\bdist.win32\egg\mechanize\_html.py", line 559, in forms
    self._forms_factory.forms())
  File "build\bdist.win32\egg\mechanize\_html.py", line 228, in forms
    raise ParseError(exc)
ParseError: <unprintable ParseError object>

请帮帮我

谢谢

最佳答案

我告诉你这是我用来解析 html 的一些 secret (目标是通过 Mechanize 强制解析 html)

br = mechanize.Browser(factory=mechanize.DefaultFactory(i_want_broken_xhtml_support=True))

关于Python/Mechanize - 无法选择表单 - ParseError(exc),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4062250/

相关文章:

python - 打开使用 Tensorflow 后端的 Keras 模型时出现 NameError

python - 如何制作两个列表并根据另一个列表删除元素?

javascript - 使用 Mechanize 单击带有 onclick ="return somejsfunction()"的按钮

ruby-on-rails - 给定一个传递给 Nokogiri 的缩短的 URL,如何获得完整的 URL?

python - 导入错误 : No module named '_curses' when trying to import blessings

python - 递归函数来计算嵌套列表中的所有项目?

python - igraph 错误识别子同构?

Python Mechanize : How to input into TextControl and click on ImageControl icon?

python - 如何使用 Mechanize 找到具有特定 ID 标签的链接对象?

ruby - 使用 Ruby mechanize 填写表单