我正在尝试使用该mechanize
模块登录网站。我的脚本是:
import mechanize
from mechanize import Browser
def main():
try:
br = mechanize.Browser()
br.open("site name")
print br.title()
except:
print "error"
if __name__ == '__main__':
main()
每次我运行它我都会得到ImportError: cannot import name GopherError
Traceback (most recent call last):
File "example.py", line 11, in <module>
import mechanize
File "C:\Python27\lib\site-packages\mechanize\__init__.py", line 85, in <modul
e>
from _mechanize import __version__
File "C:\Python27\lib\site-packages\mechanize\_mechanize.py", line 14, in <mod
ule>
from _useragent import UserAgentBase
File "C:\Python27\lib\site-packages\mechanize\_useragent.py", line 17, in <mod
ule>
import _urllib2
File "C:\Python27\lib\site-packages\mechanize\_urllib2.py", line 3, in <module
>
from urllib2 import \
ImportError: cannot import name GopherError
有人可以帮帮我吗?