Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/310.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 如何修复这样的ClientForm错误?_Python_Mechanize_Clientform - Fatal编程技术网

Python 如何修复这样的ClientForm错误?

Python 如何修复这样的ClientForm错误?,python,mechanize,clientform,Python,Mechanize,Clientform,从mechanize导入浏览器 br=浏览器() 页面=br.打开(“”) br.form=br.forms().next() 打印br.form 给我以下错误: Traceback (most recent call last): File "C:\Users\roddik\Desktop\mech.py", line 6, in <module> br.form = br.forms().next() File "build\bdist.win32\egg\mec

从mechanize导入浏览器 br=浏览器() 页面=br.打开(“”) br.form=br.forms().next() 打印br.form 给我以下错误:

Traceback (most recent call last):
  File "C:\Users\roddik\Desktop\mech.py", line 6, in <module>
    br.form = br.forms().next()
  File "build\bdist.win32\egg\mechanize\_mechanize.py", line 426, in forms
  File "D:\py26\lib\site-package\mechanize-0.1.11-py2.6.egg\mechanize\_html.py", line 559, in forms
  File "D:\py26\lib\site-packages\mechanize-0.1.11-py2.6.egg\mechanize\_html.py", line 225, in forms
  File "D:\py26\lib\site-packages\clientform-0.2.10-py2.6.egg\ClientForm.py", line 967, in ParseResponseEx
  File "D:\py26\lib\site-packages\clientform-0.2.10-py2.6.egg\ClientForm.py", line 1100, in _ParseFileEx
  File "D:\py26\lib\site-packages\clientform-0.2.10-py2.6.egg\ClientForm.py", line 870, in feed
  File "D:\py26\lib\sgmllib.py", line 104, in feed
    self.goahead(0)
  File "D:\py26\lib\sgmllib.py", line 138, in goahead
    k = self.parse_starttag(i)
  File "D:\py26\lib\sgmllib.py", line 290, in parse_starttag
    self._convert_ref, attrvalue)
  File "D:\py26\lib\sgmllib.py", line 302, in _convert_ref
    return self.convert_charref(match.group(2)) or \
  File "D:\py26\lib\site-packages\clientform-0.2.10-py2.6.egg\ClientForm.py", line 850, in convert_charref
  File "D:\py26\lib\site-packages\clientform-0.2.10-py2.6.egg\ClientForm.py", line 244, in unescape_charref

ValueError: invalid literal for int() with base 10: 'e'

这个问题是由这样的URL引起的

http://wow.zet/forum/index.php?showtopic=1197&pid=30419&st=0&#entry30419
ClientForm正在查找&#

在url中有#是可以的,但它应该在html中转义
由于&#表示字符编码

问题是由如下URL引起的

http://wow.zet/forum/index.php?showtopic=1197&pid=30419&st=0&#entry30419
ClientForm正在查找&#

在url中有#是可以的,但它应该在html中转义
因为&#意味着字符编码

嗯,我想我根本不需要uri的片段部分。现在,在发送到clientform之前,我如何更改mechanize以在html中替换它们?好吧,我想我根本不需要uri的片段部分。现在,在发送到clientform之前,如何更改mechanize以在html中替换它们?