STINNER Victor added the comment:

Antti Haapala added the comment:
> Presumably the case was that a *named* log file is opened with 'a' mode, and 
> one could pass '/dev/stdout' just like any other name of a file, and it did 
> work, but not in Python 3.5.

Oh ok, in this case, you need something smarter like:

mode = 'a' if not stat.S_ISCHR(os.stat(filename).st_mode) else 'w'
fp = open(filename, mode)

or something like (emulate append mode, but catch ESPIPE):

fp = open(filename, 'w')
try:
  fp.seek(0, os.SEEK_END)
except OSError as exc:
  if exc.errno != errno.ESPIPE: raise

----------

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

Reply via email to