[Idle-dev] [ idlefork-Bugs-706860 ] sys.path does not contain source file directory
SourceForge.net
noreply@sourceforge.net
Thu, 20 Mar 2003 04:21:50 -0800
Bugs item #706860, was opened at 2003-03-20 12:21
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=109579&aid=706860&group_id=9579
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Dickon Reed (dickon)
Assigned to: Nobody/Anonymous (nobody)
Summary: sys.path does not contain source file directory
Initial Comment:
With idlefork 0.8.1, when a script was run the current
working directory was set to the script location, and
the script location was added to sys.path. Therefore,
imports of modules in the same directory as the script
location worked even if the user had not made an effort
to place the script location on the module path.
With idlefork 0.9a2, for me it seems neither the
current working directory nor sys.path get updated with
the script location. Thus imports do not work for
modules in the same location as the script (unless the
location is in sys.path anyway).
My actions were:
1. Install python 2.2.1 from python labs on Win2K in
c:\python22
2. Install idlefork 0.9a2.
3. Rename C:\python22\scripts\idlefork to
C:\python22\scripts\idlefork.py
4. Launch C:\python22\scripts\idlefork.py
5. Create a script using idlefork 0.9a2:
import os, sys
print 'cwd', os.getcwd()
print 'path', sys.path
6. Save the script as C:\
7. Run the script from within idlefork.
8. Output is:
cwd C:\Python22\Scripts
path ['C:\Python22\Scripts', 'C:\Python22\Scripts',
'C:\Python22\DLLs', 'C:\Python22\lib',
'C:\Python22\lib\lib-tk', 'C:\Python22',
'C:\Python22\lib\site-packages']
I'm not sure whether the CWD should be updated or not
(I note idlefork 0.8.1 does, but running the script
from the path on Linux doesn't). But it shouldn't it
the case that one is able to import modules from the
same directory as the launched script without having to
worry about setting sys.path.
I haven't tried this with other platforms or the CVS
version.
I believe this is the same problem reported on
comp.lang.python here:
http://groups.google.com/groups?dq=&hl=en&lr=&ie=UTF-8&oe=utf-8&threadm=3E79728C.AED36CCD%40alcyone.com&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3Dutf-8%26group%3Dcomp.lang.python
win2k and winxp, python labs python 2.2.1
idlefork 0.9a2 from idlefork.sf.net
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=109579&aid=706860&group_id=9579