Message273207
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 |
|
Date |
User |
Action |
Args |
2016-08-20 12:36:06 | vstinner | set | recipients:
+ vstinner, hathawsh, martin.panter, ztane |
2016-08-20 12:36:06 | vstinner | link | issue27805 messages |
2016-08-20 12:36:06 | vstinner | create | |
|