jjlee / mechanize

Stateful programmatic web browsing in Python, after Andy Lester's Perl module WWW::Mechanize .
http://wwwsearch.sourceforge.net/mechanize/
618 stars 121 forks source link

KeyError u'\xe2' when calling mechanize.open #76

Open end0 opened 11 years ago

end0 commented 11 years ago

Hi - I get a KeyError when attempting to use Browser to open http://feeds.businesswire.com/click.phdo?i=18e2063489079380ce41785fbeb0a66f

Running Python2.7 on OSX Lion 10.7. I can provide more info if necessary - just tell me what

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py:1250: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal return ''.join(map(quoter, s)) Traceback (most recent call last): File "parse.py", line 62, in page = mech.open(entry.link) File "build/bdist.macosx-10.6-intel/egg/mechanize/_mechanize.py", line 203, in open File "build/bdist.macosx-10.6-intel/egg/mechanize/_mechanize.py", line 230, in _mech_open File "build/bdist.macosx-10.6-intel/egg/mechanize/_opener.py", line 204, in open File "build/bdist.macosx-10.6-intel/egg/mechanize/_urllib2_fork.py", line 457, in http_response File "build/bdist.macosx-10.6-intel/egg/mechanize/_opener.py", line 221, in error File "build/bdist.macosx-10.6-intel/egg/mechanize/_urllib2_fork.py", line 332, in _call_chain File "build/bdist.macosx-10.6-intel/egg/mechanize/_urllib2_fork.py", line 571, in http_error_302 File "build/bdist.macosx-10.6-intel/egg/mechanize/_mechanize.py", line 203, in open File "build/bdist.macosx-10.6-intel/egg/mechanize/_mechanize.py", line 230, in _mech_open File "build/bdist.macosx-10.6-intel/egg/mechanize/_opener.py", line 204, in open File "build/bdist.macosx-10.6-intel/egg/mechanize/_urllib2_fork.py", line 457, in http_response File "build/bdist.macosx-10.6-intel/egg/mechanize/_opener.py", line 221, in error File "build/bdist.macosx-10.6-intel/egg/mechanize/_urllib2_fork.py", line 332, in _call_chain File "build/bdist.macosx-10.6-intel/egg/mechanize/_urllib2_fork.py", line 571, in http_error_302 File "build/bdist.macosx-10.6-intel/egg/mechanize/_mechanize.py", line 203, in open File "build/bdist.macosx-10.6-intel/egg/mechanize/_mechanize.py", line 230, in _mech_open File "build/bdist.macosx-10.6-intel/egg/mechanize/_opener.py", line 188, in open File "build/bdist.macosx-10.6-intel/egg/mechanize/_http.py", line 320, in http_request File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/robotparser.py", line 139, in can_fetch url = urllib.quote(url) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 1250, in quote return ''.join(map(quoter, s)) KeyError: u'\xe2'