python script doesn't check cwd during import

Jeff Shannon jeff at ccvcorp.com
Wed May 29 19:33:42 EDT 2002


In article <cf701bae.0205291416.7b91dc73 at posting.google.com>, 
Inyeol Lee says...
> I'm using python2.2.1 on Solaris8.
> When I launch a python script, it imports modules from the directory
> where the script is, not from current directory. For example,
[...]
> 
> Is it a bug or a feature?

It's a feature.

Think what might happen when you package your code and install it 
on some end-user machine.  Do you really want the code that's 
imported to depend on whatever that user happened to have as his 
working directory at the time he executed your script?  

-- 

Jeff Shannon
Technician/Programmer
Credit International



More information about the Python-list mailing list