Closed FodT closed 8 years ago
This issue affects us too. The proposed solution seems to work in our case. This should be marked as urgent/critical since it breaks the functionality.
Can you give me an example of where this is breaking? My memory is slightly hazy, but I recall iter_lines(decode_unicode=True)
was there for that reason. Was this just wrong? I'll try and reproduce.
In my case it breaks when decoding some of the data. Because of the unzipping and chunks handling of the responses it was difficult for me to catch the exact info that fails to decode. I think the problem rises in models.Response.iter_content.
If you give me some hint where to dig further I help you to spot the exact place.
I'm more looking for sample code and Python version. Happy to do the digging :smile:
In fact, the problem seems to be the actual decoding. If I set:
iter_ = self._get(self.report,
params=params).iter_lines(decode_unicode=False)
It works (and that is why the re-encoding proposed seems to fix the issue)
Yeah I figured as much. What version of Python are you using? Let me dig into why I added the decode_unicode
arg in the first place. I have a feeling it's a 2/3 difference.
The problem is that the code is not what is causing the issue, but the data received. And I can't share the data (but I guess any unicode char would do the trick).
I'm using python 2.7 BTW
LOL I guess the same, looks like a Python 3 adaptation issue :p (or Python < 3 adaptation issue, it depends on which was the first used)
@MatiasSMd this should work for you now. Let us know if you run into any more issues—thanks!
CSVReader seems to choke on utf-8 chars: UnicodeEncodeError: 'ascii' codec can't encode character u'\u2013' in position 88: ordinal not in range(128)
possible fix: