New submission from Shai Berger:

At least on posix systems, os.write says it takes a string, but in fact it 
barfs on strings -- it needs bytes.

$ python
Python 3.3.1 (default, May  6 2013, 16:18:33) 
[GCC 4.7.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> print(os.write.__doc__)
write(fd, string) -> byteswritten

Write a string to a file descriptor.
>>> os.write(1, "hello")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'str' does not support the buffer interface
>>> os.write(1, b"hello")
hello5
>>>

----------
messages: 189535
nosy: shai
priority: normal
severity: normal
status: open
title: os.write.__doc__ is misleading
type: behavior
versions: Python 3.3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18009>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to