import error

Steve Holden steve at holdenweb.com
Sat Mar 17 11:48:09 CET 2007


Gabriel Genellina wrote:
> En Fri, 16 Mar 2007 23:49:43 -0300, Nick Burns <theodoremouse at hotmail.com>  
> escribió:
> 
>> Quick question. I am running python on windows xp. i want to import my  
>> own
>> module "mymod". However, when I try to import it i get the error message  
>> "ImportError:
>> no module named mymod".
>>
>> "mymod" is located in a directory that is part of the computer's "path"  
>> env
>> variable. Imports fine if 'mymod' is in the current working directory,  
>> but not
>> otherwise. i had thought that by saving 'mymod'within my normal path  
>> that it
>> would import successfully, but this is not the case.
> 
> Python does not use the system PATH environment variable. Doing this:
> 
> import sys
> print sys.path
> 
> you will see the list of directories that Python would try. Try saving  
> your module inside site-packages.
> 

Or investigate appropriate settings of the PYTHONPATH environment 
variable, whose elements will be added to sys.path at interpreter 
startup. The "path" environment variable is for locating executables, 
not Python libraries.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Skype: holdenweb     http://del.icio.us/steve.holden
Recent Ramblings       http://holdenweb.blogspot.com




More information about the Python-list mailing list