New submission from Martin Panter: >>> f = open("/dev/stdout", "w+b") # Or any non-seekable file, pipe, etc __main__:1: ResourceWarning: unclosed file <_io.FileIO name='/dev/stdout' mode='rb+'> Traceback (most recent call last): File "<stdin>", line 1, in <module> io.UnsupportedOperation: File or stream is not seekable.
It is mainly just the annoyance of the ResourceWarning, so nothing major. I think this was previously identified in Issue 18116, but it looks like that bug was side-stepped by removing an equivalent fdopen() call. No ResourceWarning happens with an unbuffered file. I haven’t looked at the code but I guess the UnsupportedOperation might only be raised after trying to wrap the open FileIO object in a BufferedWriter object. ---------- components: IO messages: 216838 nosy: vadmium priority: normal severity: normal status: open title: ResourceWarning when open() fails with io.UnsupportedOperation: File or stream is not seekable versions: Python 3.4 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21310> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com