Response = UserAgentBase.open(self, request, data)įile "C:\Python27\lib\site-packages\mechanize\_opener.py", line 206, in openįile "C:\Python27\lib\site-packages\mechanize\_urllib2_fork.py", line 467, in http_response Return self._mech_open(url_or_request, data, timeout=timeout)įile "C:\Python27\lib\site-packages\mechanize\_mechanize.py", line 284, in _mech_open You can use it if you need a quick and dirty fix )īTW, I didn't know that it is this easy to make changes to the default libs.įile "C:\Users\n_lac\Documents\python\udemy coupon.py", line 40, inįile "C:\Python27\lib\site-packages\mechanize\_mechanize.py", line 254, in open It worked like a charm! no strange settings or other oddities were needed.Īs I said, not a pro python programmer here, I'm sure there is a better solution, my solution probably would have implication on overall performance, cause trouble when upgrading python or I don't know, because it is a python lib file. Return _compile(pattern, flags).sub(repl, code('utf-8'), count) I opened the re.py file and changed the function definition to: What I've found is to make some changes in the config files from python, which I don't really know how to do and it was not recommended, or to use decode('utf-8') function on the string variable and usage that caused the issue.Īs you can see in the full error log, listed down below, I traced the error to the first call from the call stack:įile "C:\Python27\lib\re.py", line 155, in sub return _compile(pattern, flags).sub(repl, string, count) I've started to investigate the issue, found some information on stackoverflow, but I was confused, I don't really know python that well. UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 50: ordinal not in range(128) The script was old(2 years), and it needed some refinement, but I managed to make it work to start griding my over 7000 links, after 30 minutes later I saw it crashed with a strange error: Nothing special, get a list of links from a csv, login to a page, and access a link from the opened page by match. Yesterday I've found a tool that I needed, it was written in python. Disclaimer: I'm not a python developer :)
0 Comments
Leave a Reply. |