Message 72396 - Python tracker (original) (raw)
On the code against the trunk, I am getting the following error:
Traceback (most recent call last): File "python3k_json.py", line 38, in for result in search(query)['Result']: File "python3k_json.py", line 31, in search result = json.load(obj) File "/usr/local/lib/python3.0/json/init.py", line 267, in load parse_constant=parse_constant, **kw) File "/usr/local/lib/python3.0/json/init.py", line 307, in loads return _default_decoder.decode(s) File "/usr/local/lib/python3.0/json/decoder.py", line 319, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) TypeError: can't use a string pattern on a bytes-like object
Swaroop: What encoding would be the JSON File content? You can try by passing the encoding argument to the load method. I tried latin1 and ascii, did not help.
Few more things to note:
- The above TypeError was introduced by the fix of Issue2834.
- There are also bugs open in other modules (shutil, imaplib) where problems with str<->bytes conversions are observed.