[Tutor] Importing files not located on the home directory orstandardard library

Alan Gauld alan.gauld at btinternet.com
Thu Jun 17 19:21:59 CEST 2010


"Independent Learner" <nbr1ninrsan7 at yahoo.com> wrote

> Lets say I want to load a file called quiz located in 
> C:\Users\Julius
> Hernandez\Desktop\Python2.6.5\Online Course\Chp.4
>
> How would I configure PYTHONPATH or .pth or what ever
> to import this file from IDLE

The IDLE bit is irrelevant its how the underlying Python
interpreter does things that matters.

You would need to set your PYTHONPATH environment variable
to include the directory containing your modules.

Do you know how to add values to a Windows Environment variable?
If not go to the Getting Started topic of my tutor for an example of
setting the PATH variable (You do the same but for PYTHONPATH,
the only difference is you might need to create it if it doesn't
already exist!)

Otherwise, Where are you having problems?

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/




More information about the Tutor mailing list