[Tutor] newbie problems with running scripts

Daniel Yoo dyoo@hkn.EECS.Berkeley.EDU
Sun, 20 Aug 2000 02:37:46 -0700 (PDT)

On Sun, 20 Aug 2000, Andre Quintos wrote:

> I tried your suggestions but I still get the same error kind of errors.

Where are you storing myfile.py?  This is important, since Python needs to
be told where to look for modules.  By default, it's just going to look at
the standard distribution's /Lib/ directory, as well as the current

You need to override the default paths, so that Python will be able to see
myfile.py too.  Once you have the paths set up right, then everything
should work.  Theoretically.  *grin*

I think there are two ways of setting up the paths, the first through the
system registry, and the second through the PYTHONPATH environment
variable.  I'm only familiar with the environment variable way, so I'll
talk about that one only.

If you're not familiar with setting up environment variables, read
ahead.  Otherwise, please forgive me for being pedantic.  I'll assume that
your installation is stored in 'C:\Program Files\Python1.5'.

Right click on My Computer, and go to the Properties screen.  You should
see a tab called Environmental Variables.  (it should be right next to the
User Profiles tab, I think.)  Once you're there, add a new environment
variable called PYTHONPATH, with the value 'C:\[wherever your document
path is].' Afterwards, move myfile.py into your document path, and you
should be fine with the imports.

You can always add more paths to PYTHONPATH, if you like storing your
modules somewhere else.

I hope this is helpful.