We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The generated code tries to open the file as text without checking if its binary:
with open('file.jpeg') as f: dataList.append(f.read())
which leads to the following error:
Traceback (most recent call last): File "test.py", line 14, in <module> dataList.append(f.read()) File "/usr/lib/python3.8/codecs.py", line 322, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
Even if you manually change code to open the file as binary:
with open('file.jpeg', 'rb') as f: dataList.append(f.read())
The code still fails:
Traceback (most recent call last): File "test.py", line 17, in <module> body = '\r\n'.join(dataList) TypeError: sequence item 4: expected str instance, bytes found
This is because the join method fails if the given list contains binary data.
Note: The bug only exists for Python 3 as http.client is Python 3 only.
The text was updated successfully, but these errors were encountered:
webholik
Successfully merging a pull request may close this issue.
The generated code tries to open the file as text without checking if its binary:
which leads to the following error:
Even if you manually change code to open the file as binary:
The code still fails:
This is because the join method fails if the given list contains binary data.
Note: The bug only exists for Python 3 as http.client is Python 3 only.
The text was updated successfully, but these errors were encountered: