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 marco
Recipients marco
Date 2011-11-30.02:51:03
SpamBayes Score 2.7755576e-16
Marked as misclassified No
Message-id <1322621465.07.0.137768445913.issue13506@psf.upfronthosting.co.za>
In-reply-to
Content
The IDLE shell sys.path does not contains any entry for the Current Working Directory ('' or '.' or '.\'); without it, when changing the CWD with os.chdir(), the shell cannot find, execute or import scripts or module in it.

I can start the standard Python interactive shell and os.chdir to any dev or test directories and import or call scripts and modules, or I can cd first to any of those directories from any shell (sh, batch, cmd.com), then start Python interactive shell and import or call scripts and modules, because there is the CWD available in the sys.path as ''.

I tried to manually add it to IDLE:

from cli by calling idle.py or idle.pyw with "-cimport sys;sys.path.insert(0,"");del sys"

or by making a IDLESTARTUP.py script

import sys
sys.path.insert(0,"")
del sys

and setting the IDLESTARTUP env var pointing at it

but these work in adding the CWD to sys.path only for the first run (start) of IDLE shell; but when it get restarted (ex.: the Shell/Restart Shell toolbar option) the CWD get reset without the CWD entry, and again it has the same problem

I also tried to cd from shell (sh, bash, cmd.com) first and then start IDLE and it worked for importing and calling modules and scripts in the specific dev/test directory, but it failed to import or call other standard scripts that actually are in the sys.path (ex.: win32ui).

This is needed to use IDLE to develop and test new scripts and modules not yet ready to be included into the standard libraries and paths, so momentarily modifying the path as above that also does not survive restarts made within the application, or permanently modifying the path statically to include any dev and test dir by adding the absolute path(s ) to env var PYTHONPATH are both not correct way.

And anyway it is not consistent with the behavior of the standard Python interactive shell that includes the CWD in sys.path (as '' right at the beginning), therefore os.chdir('to any non in sys.path dirs') works correctly in contrast with IDLE shell behavior... and who knows what else it breaks.

I am not an expert on python environment, but I have 20+ years professional experience in many other high profile QA dev and testing project (just Google me), so I just thing it should be fixed, since I see this problem since 2008 and I know others that have the same issue for long time before that.
I assure you inconsistency in IDLE and Python like that separate production products from hack toys and I know for a fact are alienating both novices and veterans, because first it makes it difficult to use IDLE for basic learning and second, because it get you skeptical to trust the rest of Python will behave differently and correctly for main development, since its main IDE distributed with the language does not.

If there is anything that I don't see just let me know,
thanks.
History
Date User Action Args
2011-11-30 02:51:05marcosetrecipients: + marco
2011-11-30 02:51:05marcosetmessageid: <1322621465.07.0.137768445913.issue13506@psf.upfronthosting.co.za>
2011-11-30 02:51:04marcolinkissue13506 messages
2011-11-30 02:51:03marcocreate