[issue11851] Flushing the standard input causes an error
Ned Deily n...@acm.org added the comment: Given that it is undefined, the puzzle is that it exists at all, even to be called. No puzzle at all: in Python 2, stdin is a file object which automatically has a flush method. And the behavior seen here is not limited to OS X; FreeBSD, for one, gives exactly the same error. -- components: -Macintosh nosy: +ned.deily ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11851 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11851] Flushing the standard input causes an error
Roger Binns pyt...@rogerbinns.com added the comment: I'm the APSW author. The reason why this apparent nonsense is done is due to using readline and completion. That requires being able to write to standard input when it is a terminal - something that Windows and Linux are happy to do. In any event I'll put a try/catch around this and ignore. -- nosy: +rogerbinns ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11851 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11851] Flushing the standard input causes an error
Changes by Edzard Pasma pasm...@concepts.nl: -- components: None nosy: pasm...@concepts.nl priority: normal severity: normal status: open title: Flushing the standard input causes an error type: behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11851 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11851] Flushing the standard input causes an error
New submission from Nadeem Vawda nadeem.va...@gmail.com: Could you provide more details on the problem? What version of Python did you encounter this error under? A short code fragment that triggers the error would also be useful. (I get no errors executing sys.stdin.flush() on 2.6.6 or 3.3) -- nosy: +nadeem.vawda ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11851 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11851] Flushing the standard input causes an error
Changes by STINNER Victor victor.stin...@haypocalc.com: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11851 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11851] Flushing the standard input causes an error
Edzard Pasma pasm...@concepts.nl added the comment: Hello, The error occured in the APSW shell, when using its .output command. Looking at the apsw source, it appears to perform a sys.stdin.flush() at that point. Trying this in the Python interpreto gives the same error: $ python Python 2.7.1 (r271:86882M, Nov 30 2010, 09:39:13) [GCC 4.0.1 (Apple Inc. build 5494)] on darwin Type help, copyright, credits or license for more information. import sys sys.stdin.flush built-in method flush of file object at 0x28020 sys.stdin.flush() Traceback (most recent call last): File stdin, line 1, in module IOError: [Errno 9] Bad file descriptor But in Python3 it no longer occurs. I'd like to report this to the developer of the APSW module as it appears most easy to avoid it there (also there are more frequent releases). I hope it is useful to report it here too. Regards, E. Pasma (sorry that the original post was empty) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11851 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11851] Flushing the standard input causes an error
Changes by Éric Araujo mer...@netwok.org: -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11851 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11851] Flushing the standard input causes an error
Jesús Cea Avión j...@jcea.es added the comment: I can't reproduce this Under Solaris 10 or Ubuntu. Maybe is it something Apple related?. Anyway, does it makes sense to flush sys.stdin, at all?. -- nosy: +jcea ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11851 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11851] Flushing the standard input causes an error
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: I get the same: $ python2.7 Python 2.7.1 (r271:86882M, Nov 30 2010, 10:35:34) [GCC 4.2.1 (Apple Inc. build 5664)] on darwin Type help, copyright, credits or license for more information. import sys sys.stdin.flush() Traceback (most recent call last): File stdin, line 1, in module IOError: [Errno 9] Bad file descriptor I'll look further. -- assignee: - belopolsky nosy: +belopolsky ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11851 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11851] Flushing the standard input causes an error
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: In python 2.x, sys.stdin.flush() is more or less equivalent to C fflush(stdin). The behavior of fflush() on streams that are open for reading only is undefined. [1] Python 3.x io does not use C stdio library and therefore it is not surprising that the behavior is different. [1] http://pubs.opengroup.org/onlinepubs/009695399/functions/fflush.html -- components: +Interpreter Core -None resolution: - invalid stage: - committed/rejected status: open - closed versions: +Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11851 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11851] Flushing the standard input causes an error
Terry J. Reedy tjre...@udel.edu added the comment: Python 2.7.1 ... 32 bit (Intel)] on win32 import sys sys.stdin.flush() stdin.flush() could mean to clear (discard) the input buffer. Given that it is undefined, the puzzle is that it exists at all, even to be called. Consistency across platforms is why we wrote io for Py3. Agreed not a bug for 2.x. -- components: +Macintosh nosy: +terry.reedy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11851 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11851] Flushing the standard input causes an error
Edzard Pasma pasm...@concepts.nl added the comment: Thanks a lot, especially for making clear what flushing an input stream means (or that it is meaningless). I hope it will be solved in APSW, there is an issue now: http://code.google.com/p/apsw/issues/detail?id=117 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11851 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com