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 Todd.Rovito, amaury.forgeotdarc, asvetlov, devplayer, ggenellina, ned.deily, roger.serwy, terry.reedy
Date 2014-02-26.21:56:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1393451777.85.0.89125615105.issue13582@psf.upfronthosting.co.za>
In-reply-to
Content
Idle start up seems unnecessarily fragmented into multiple files.
  idlelib/__main__.py 
  idlelib/idle.py
  idlelib/idlew.py
can all be started from the command line by name with either python or pythonw or run once by import. idlelib/__main__.py can also be started by 'python(w) -m idlelib'.

I checked that in Command Prompt
  C:\Programs\Python34>python lib/idlelib/idle.py
  C:\Programs\Python34>python lib/idlelib/idle.pyw
  C:\Programs\Python34>pythonw lib/idlelib/idle.py
  C:\Programs\Python34>pythonw lib/idlelib/idle.pyw
all do the same thing except that the first two caused a new console python icon to appear on the taskbar.

All three files contain
  import idlelib.PyShell
  idlelib.PyShell.main()
which are equivalent to
  from idlelib.PyShell import main; main()
PyShell can also by run by 'python(w) -m idlelip.PyShell' though I believe that is somewhat 'deprecated'.

idle.py also has a path addition that seems obsolete. I believe the addition was intended for developing idle with installed python and a subrepository consisting of idlelib/*. Subrepositories were possible with svn but are not with hg. In any case, proper development testing ultimately requires testing revised idle with current tkinter.py and compiled _tkinter.c. I suppose that the addition would still work to let someone clone the repository and run the repository Lib/*.py, etc, with installed binaries, but that seems ultimately chancy.

idle.pyw (which is also called by idle.bat) has additions for a scenario that I don't understand: idle.pyw is present and running but apparently not in idlelib, Idle is 'not installed', but PyShell and the rest of idlelib are somewhere on sys.path. There is nothing that I see as pythonw specific. I think this file should be dropped and any needed path manipulations added to idle.py.

A single start up file (idle.py) should first import tkinter (and _tkinter) as in the patch, but in try;except. If the import fails print to stderr if there is one (a console) or use subprocess to start python in a console to display the message. Ditto for creating root. Once that succeeds, I think stderr or the idle process should be replaces  unconditionally. A message box as in the patch is one possibility. An error log window is another. The latter could accumulate all non-fatal error messages to be edited and saved if the user wishes. I think the arg parsing code in PyShell that decides whether to open a Shell or an Editor should be moved to the startup file. Ditto for any other configuration stuff that precedes opening one or the other.
History
Date User Action Args
2014-02-26 21:56:17terry.reedysetrecipients: + terry.reedy, amaury.forgeotdarc, ggenellina, ned.deily, roger.serwy, asvetlov, Todd.Rovito, devplayer
2014-02-26 21:56:17terry.reedysetmessageid: <1393451777.85.0.89125615105.issue13582@psf.upfronthosting.co.za>
2014-02-26 21:56:17terry.reedylinkissue13582 messages
2014-02-26 21:56:16terry.reedycreate