Message94791
When I have the following code:
blah.py
=======
import getpass
nothing = getpass.getpass("blah:")
And I run it like so:
>>> sleep 5
./blah.py <return>
<return>
(I write the ./blah.py and returns while the sleep occurs)
I get the following stack-trace:
Traceback (most recent call last):
File "./xuy.py", line 5, in <module>
nothing = getpass.getpass("XUY:")
File "/usr/local/lib/python2.6/getpass.py", line 81, in unix_getpass
stream.write('\n')
IOError: [Errno 29] Illegal seek
close failed in file object destructor:
IOError: [Errno 29] Illegal seek
This error occurs only when getpass is called with 2 or more returns in
the buffer. One return will not reveal the problem.
Running this code with strace shows clearly that the seek problem is
because that for return in the buffer it tries to seek back. 2 returns
will cause it to seek -2. 7 returns will cause it to seek -7.
This problem was introduced in python 2.6, and is maintained throughout
the minor releases of python 2.6 - 2.6.4. It doesn't appear in python
2.5 and before, and it doesn't appear in python 3.
Doing sys.stdin.flush() doesn't resolve this issue. |
|
Date |
User |
Action |
Args |
2009-11-01 16:46:28 | avihu | set | recipients:
+ avihu |
2009-11-01 16:46:28 | avihu | set | messageid: <1257093988.16.0.063739997235.issue7246@psf.upfronthosting.co.za> |
2009-11-01 16:46:26 | avihu | link | issue7246 messages |
2009-11-01 16:46:26 | avihu | create | |
|