Issue 12438: IDLE problem displaying warning message (original) (raw)

The getpass function is raising an error when first used on idle (Python 3.2 and 2.7.1)

The next time it'll work "as expected" (it echoes the data, but idle is just for testing purposes so no problems here)

from getpass import getpass p = getpass() Traceback (most recent call last): File "<pyshell#1>", line 1, in p = getpass() File "/usr/lib/python3.2/getpass.py", line 55, in unix_getpass passwd = fallback_getpass(prompt, stream) File "/usr/lib/python3.2/getpass.py", line 114, in fallback_getpass stacklevel=2) File "/usr/lib/python3.2/idlelib/PyShell.py", line 62, in idle_showwarning lineno, file=file, line=line)) TypeError: idle_formatwarning() got an unexpected keyword argument 'file' p = getpass() Warning: Password input may be echoed. Password: ok

p 'ok'

Looking at the "/usr/lib/python3.2/idlelib/PyShell.py" file the "idle_formatwarning" function don't have the "file" argument so it should be revomed from the function call at line 61:

file.write(warnings.formatwarning(message, category, filename, lineno, file=file, line=line))

Have fixed this. Even looking at the code, your suggestion was correct. But even before the fix, I was not able to reproduce the bug in Ubuntu and perhaps it was getting masked. May I ask, how did you invoke idle that this bug surfaced and what was the platform?