classification
Title: IDLE problem displaying warning message
Type: crash Stage: resolved
Components: IDLE Versions: Python 3.3, Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: JBernardo, orsenthil, python-dev, r.david.murray, terry.reedy
Priority: normal Keywords:

Created on 2011-06-29 01:06 by JBernardo, last changed 2011-07-09 08:58 by python-dev. This issue is now closed.

Messages (6)
msg139385 - (view) Author: João Bernardo (JBernardo) Date: 2011-06-29 01:06
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 <module>
    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))
msg139413 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2011-06-29 13:10
The problem isn't with getpass, the problem is that getpass is generating a warning message on first call and idle isn't handling that correctly.  Your suggested fix is probably correct.
msg139722 - (view) Author: Roundup Robot (python-dev) Date: 2011-07-04 00:40
New changeset c9f69b28c4d1 by Senthil Kumaran in branch '2.7':
Fix closes issue12438  - idlelib.PyShell's showformatwarning method was passing an incorrect arg.
http://hg.python.org/cpython/rev/c9f69b28c4d1

New changeset e9c406a53972 by Senthil Kumaran in branch '3.2':
Fix closes issue12438  - idlelib.PyShell's showformatwarning method was passing an incorrect arg.
http://hg.python.org/cpython/rev/e9c406a53972
msg139723 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2011-07-04 00:42
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?
msg139727 - (view) Author: João Bernardo (JBernardo) Date: 2011-07-04 01:06
@orsenthil

My system is Ubuntu 11.04 x64. To run idle, i press the Super (windows button) then write idle.

If I open the terminal and type "idle", the problem don't appear but I have to type the password on the terminal rather than on idle GUI.
msg140053 - (view) Author: Roundup Robot (python-dev) Date: 2011-07-09 08:58
New changeset 7dd9313c300b by Senthil Kumaran in branch '3.2':
Fix closes issue12438  - idlelib.PyShell's showformatwarning method was passing an incorrect arg.
http://hg.python.org/cpython/rev/7dd9313c300b
History
Date User Action Args
2011-12-23 07:04:20ned.deilylinkissue13654 superseder
2011-07-09 08:58:08python-devsetmessages: + msg140053
2011-07-04 01:06:49JBernardosetmessages: + msg139727
2011-07-04 00:42:51orsenthilsetnosy: + orsenthil
messages: + msg139723
2011-07-04 00:40:56python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg139722

resolution: fixed
stage: needs patch -> resolved
2011-06-29 13:10:45r.david.murraysetnosy: + r.david.murray, terry.reedy
title: getpass error on idle -> IDLE problem displaying warning message
messages: + msg139413

versions: + Python 3.3, - Python 3.1
stage: needs patch
2011-06-29 01:06:31JBernardocreate