[issue24159] Misleading TypeError when pickling bytes to a file opened as text

2019-11-02 Thread stein-k
Change by stein-k : -- nosy: +stein-k ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue24159] Misleading TypeError when pickling bytes to a file opened as text

2019-11-01 Thread Борис Верховский
Борис Верховский added the comment: As I said in issue38226, the error message you get when you try to pickle.load() a file opened in "r" mode instead of "rb" mode, UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte is also confusing and can be

[issue24159] Misleading TypeError when pickling bytes to a file opened as text

2018-02-19 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- versions: +Python 3.8 -Python 3.7 ___ Python tracker ___

[issue24159] Misleading TypeError when pickling bytes to a file opened as text

2017-02-19 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I think it is worth to improve the error message in the write() method of binary files. >>> sys.stdout.write(b'') Traceback (most recent call last): File "", line 1, in TypeError: write() argument must be str, not bytes >>> sys.stdout.buffer.write('')

[issue24159] Misleading TypeError when pickling bytes to a file opened as text

2015-05-11 Thread Ned Deily
Changes by Ned Deily n...@acm.org: -- nosy: +alexandre.vassalotti, pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24159 ___ ___

[issue24159] Misleading TypeError when pickling bytes to a file opened as text

2015-05-10 Thread Jon Clements
Changes by Jon Clements jon...@googlemail.com: -- nosy: +joncle ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24159 ___ ___ Python-bugs-list

[issue24159] Misleading TypeError when pickling bytes to a file opened as text

2015-05-10 Thread Jason R. Coombs
New submission from Jason R. Coombs: I had a piece of code which I distilled to this: import pickle with open('out.pickle', 'w') as out: pickle.dump(out, b'data') Running that code raises this error: TypeError: must be str, not bytes The error is raised at the dump call with no