This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author joseluisfb
Recipients docs@python, joseluisfb
Date 2011-01-07.20:02:48
SpamBayes Score 6.1150025e-08
Marked as misclassified No
Message-id <1294430571.2.0.193589316262.issue10863@psf.upfronthosting.co.za>
In-reply-to
Content
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])
History
Date User Action Args
2011-01-07 20:02:51joseluisfbsetrecipients: + joseluisfb, docs@python
2011-01-07 20:02:51joseluisfbsetmessageid: <1294430571.2.0.193589316262.issue10863@psf.upfronthosting.co.za>
2011-01-07 20:02:48joseluisfblinkissue10863 messages
2011-01-07 20:02:48joseluisfbcreate