【发布时间】:2017-02-16 10:02:39
【问题描述】:
我无法使用 mechanize code )。导致错误的部分是
#!/usr/bin/python
import re
from mechanize import
br = Browser()
我也试过了
用python3.5执行时,发现如下错误:
# python mechanize.py
Traceback (most recent call last):
File "mechanize.py", line 6, in <module>
from mechanize import Browser
File "/root/git/stakexchange-ask-question/mechanize.py", line 6, in <module>
from mechanize import Browser
ImportError: cannot import name Browser
不过这正是官方mechanize website所建议的
如果我将代码修改为
#!/usr/bin/python
import re
br = mechanize.Browser()
我也遇到了错误
# python mechanize.py
Traceback (most recent call last):
File "mechanize.py", line 5, in <module>
import mechanize
File "/root/git/stakexchange-ask-question/mechanize.py", line 6, in <module>
br =mechanize.Browser()
AttributeError: module 'mechanize' has no attribute 'Browser'
我已经用
安装了mechanize
easy_install mechanize
【问题讨论】:
标签: python html linux forms mechanize