New submission from Jose-Luis Fernandez-Barros jlfbarros@gmail.com:
On "The Python Tutorial", section 10.9. Data Compression http://docs.python.org/py3k/tutorial/stdlib.html#data-compression
import zlib s = 'witch which has which witches wrist watch'
...
t = zlib.compress(s)
Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: must be bytes or buffer, not str
Possible solution (sorry, newbie) are:
s = b'witch which has which witches wrist watch'
or
s = 'witch which has which witches wrist watch'.encode("utf-8")
At "The Python Standard Library", secction 12. Data Compression and Archiving http://docs.python.org/py3k/library/zlib.html#module-zlib apparently example is correct: zlib.compress(string[, level])
---------- assignee: docs@python components: Documentation messages: 125702 nosy: docs@python, joseluisfb priority: normal severity: normal status: open title: zlib.compress() fails with string type: compile error versions: Python 3.1
_______________________________________ Python tracker report@bugs.python.org http://bugs.python.org/issue10863 _______________________________________
Georg Brandl georg@python.org added the comment:
This is already fixed in dev docs, just needs backporting.
---------- nosy: +georg.brandl resolution: -> fixed status: open -> closed
_______________________________________ Python tracker report@bugs.python.org http://bugs.python.org/issue10863 _______________________________________
Jose-Luis Fernandez-Barros jlfbarros@gmail.com added the comment:
Thanks for your answer.
Error remains at development "The Python Standard Library", secction 12. Data Compression and Archiving http://docs.python.org/dev/py3k/library/zlib.html#module-zlib zlib.compress(string[, level])
---------- resolution: fixed -> status: closed -> open
_______________________________________ Python tracker report@bugs.python.org http://bugs.python.org/issue10863 _______________________________________
Georg Brandl georg@python.org added the comment:
Quite right, this is now fixed in r87870.
----------
_______________________________________ Python tracker report@bugs.python.org http://bugs.python.org/issue10863 _______________________________________
Changes by Georg Brandl georg@python.org:
---------- resolution: -> fixed status: open -> closed
_______________________________________ Python tracker report@bugs.python.org http://bugs.python.org/issue10863 _______________________________________