Terry J. Reedy added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue13582>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to