PythonWin Open(file) path bug?

Miki Tebeka tebeka at cs.bgu.ac.il
Wed Apr 9 08:42:59 EDT 2003


Hello Vector,

> the file is in the same folder as the python script
> i get the same error if opened from the interactive window
> import sys
> print sys.path
> indeed shows the script dir is on the path so why cant it find the 
> config file?
> 
> If i call the script direct from explorer (no IDE) it works fine
> if I open lptctrl.cfg within pythonWin and save As it then runs and 
> finds the file(it must be save as, even modifing and just save dosent 
> change the error)
There is a notion of 'working folder', this is the folder where the
application is running. In your case when working from the IDE it's
the IDE's working folder ($PYTHON/Lib/site-packages ...). Try giving
full path to your file and you should be fine. Or do os.chdir to the
right directory to change the current working folder.
sys.path has nothing to do with this problem, it's the path where
Python looks for modules when you import them.


HTH.
Miki




More information about the Python-list mailing list