This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients terry.reedy
Date 2015-05-16.21:46:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1431812813.24.0.960232018759.issue24212@psf.upfronthosting.co.za>
In-reply-to
Content
Discussion on another issue suggested that 3.x idlelib.__main__ be backported to 2.7 so 'python -m idlelib would work with 2.7 as with 3.x.  The current file:

"""
IDLE main entry point
Run IDLE as python -m idlelib
"""
import idlelib.PyShell
idlelib.PyShell.main()

When I tried this, it failed two ways.

1. The AutoComplete and CallTips extensions did not import properly. The error messages are printed from the except clause in EditorWindow.load_standard_extensions. I presume this call results from "import EditorWindow" in PyShell.

Failed to load extension 'AutoComplete'
Traceback (most recent call last):
  File "C:\Programs\Python27\lib\idlelib\EditorWindow.py", line 1068, in load_standard_extensions
    self.load_extension(name)
  File "C:\Programs\Python27\lib\idlelib\EditorWindow.py", line 1083, in load_extension
    cls = getattr(mod, name)
AttributeError: 'module' object has no attribute 'AutoComplete'

Somehow AutoComplete was imported without an ImportError even though the class AutoComplete statement did not create the class asstribute.

AutoComplete and CallTips are the two extensions containing "import __main__".  Adding idlelib.__main__ somehow causes weird behavior in 2.7, though not in 3.x.  Commenting out these imports removes the import problem.

2. Even with 1 temporarily fixed with '#', an unsaved file 'named' C:\users\terry\NNNNN.py is open in an editor window.  ("Unsaved' and'named' areusually mutually exclusive.) Two shell windows, instead of one, are opened.  One fails to connect to a subprocess.  Clicking away the message box raises SystemExit.

Changing __main__.py to ...
from idlelib.PyShell import *
main()

had no effect.

I will add a reference to this issue in the file.  (If should be removed if this issue is fixed.)
History
Date User Action Args
2015-05-16 21:46:53terry.reedysetrecipients: + terry.reedy
2015-05-16 21:46:53terry.reedysetmessageid: <1431812813.24.0.960232018759.issue24212@psf.upfronthosting.co.za>
2015-05-16 21:46:53terry.reedylinkissue24212 messages
2015-05-16 21:46:52terry.reedycreate