New submission from Shane Hathaway:

With Python 2, the following call worked:

open('/dev/stdout', 'a')

Users of Supervisor have been depending on that for a long time. 

With Python 3.5, this is what happens:

>>> open('/dev/stdout', 'a')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 29] Illegal seek

Presumably, this happens because Python 3 opens the file in 'w' mode and seeks 
to the end, while Python 2 passed the 'a' flag directly to the underlying C 
library; the underlying library is apparently smart enough to treat 'a' and 'w' 
identically when opening character device files and FIFOs.

It's a nasty little surprise for those upgrading from Python 2.

components: IO
messages: 273158
nosy: hathawsh
priority: normal
severity: normal
status: open
title: In Python 3, open('/dev/stdout', 'a') raises OSError with errno=ESPIPE
versions: Python 3.5

Python tracker <>
Python-bugs-list mailing list

Reply via email to