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 r.david.murray
Recipients r.david.murray
Date 2009-06-18.02:51:43
SpamBayes Score 3.033623e-08
Marked as misclassified No
Message-id <1245293505.96.0.175038220478.issue6304@psf.upfronthosting.co.za>
In-reply-to
Content
The documentation for the print function specifies that the input
argument is coerced to string.  However, if bytes are passed and the
file= parameter points to a file open for binary write, the error
message produced is:

>>> out = open('temp', 'wb')
>>> print(b'abc', file=out)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: write() argument 1 must be bytes or buffer, not str

which is, to say the least, confusing, since I clearly passed print a
bytes object as argument 1.
History
Date User Action Args
2009-06-18 02:51:46r.david.murraysetrecipients: + r.david.murray
2009-06-18 02:51:45r.david.murraysetmessageid: <1245293505.96.0.175038220478.issue6304@psf.upfronthosting.co.za>
2009-06-18 02:51:44r.david.murraylinkissue6304 messages
2009-06-18 02:51:43r.david.murraycreate