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 markroseman, terry.reedy
Date 2015-10-27.11:18:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1445944731.76.0.817427866108.issue25488@psf.upfronthosting.co.za>
In-reply-to
Content
When python is started without running a file (Windows icon or command line), '' is prepended to sys.path.  When IDLE is started from 3.5 icon, '' is prepended temporally after and spatially before '.../idlelib', so the latter, to be removed, is sys.path[1] and not sys.path[0].

'' in sys.path interpreted as the current working directory.

When IDLE is started from the command line with '-m idlelib' instead of '.../idlelib/idle.py' (for instance), the current working directory is added instead of .../idlelib (in second position).

Adding the startup current directory is redundant with '' until the user imports os and changes the cwd.  Then I expect the behavior of Shell to be different from python interactive mode, which would be a bug.  I will try to find a test case later.
  
PyShell.main manipulates 'sys.path' in lines 1521 and 1525, but these are sys.argv of the idle process, not the user process, each of which have their own sys.argv. If filenames are given on the command line to be edited, the directory of each is added to sys.path *for the idle process* (line 1521).  I suspect this is for completions. Line 1525 add the current working directory.  I don't know why.  Perhaps it is a holdover for -n single process mode.
History
Date User Action Args
2015-10-27 11:18:51terry.reedysetrecipients: + terry.reedy, markroseman
2015-10-27 11:18:51terry.reedysetmessageid: <1445944731.76.0.817427866108.issue25488@psf.upfronthosting.co.za>
2015-10-27 11:18:51terry.reedylinkissue25488 messages
2015-10-27 11:18:51terry.reedycreate