[Tutor] folder and module

Liam Clarke ml.cyresse at gmail.com
Sun Sep 17 13:06:20 CEST 2006


Hi Linda,

At your Python prompt try the following:

>>> import sys
>>> print sys.path

What directories are listed there?


On 9/17/06, linda.s <samrobertsmith at gmail.com> wrote:
> > > i have test.py under c:\try1\new;
> > > I want to import b and b.py is under c:\trytry. How to do it?
> > > Also, I import c and c.py is in the desktop folder but no error
> > > reported.
> >
> > Python imports modules by looking for them in the folders
> > listed in the variable sys.path. sys.path gets populated when
> > Python starts up and includes some standard locations plus
> > any you define in your PYTHONPATH environment variable.
> >
> I checked my PYTHONPATH environment variable (both user variables and
> system variables) but I only see a directory (which is a downloaded
> python library's directory listed under PYTHONPATH in user variables .
> My questions are:
> 1. since the desktop directory is not listed in the PYTHONPATH ,
> why there is no error report when I import a module which is in the desktop?
> 2. why there is no directory such as c:\python24 where I install the python?
> Thanks,
> Linda
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list