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

Independent Learner nbr1ninrsan7 at yahoo.com
Thu Jun 17 09:10:32 CEST 2010


I am having trouble figuring out how to import modules not located on the home directory or standard library of modules. Meaning say I write a module and instead of saving it on the home directory I save in a folder in my desktop. I do not know how to retrieve it by way of the import statement. I know it has something to do with the PYTHONPATH or .pth,  however I am not sure how to configure these, right now I am reading Learning Pythong 3rd ed. by Mark Lutz and unfortnately that book has a lot more words then examples so I am usually left to figure alot of the concepts myself while rereading word for word to try to figure out how the heck it applies to IDLE and practical uses for code. I thoroughly understand modules and how to import them when they are in the home directory or standard library, thats pretty simple, however like I said I do not know how to import files outside of these directories. I am using windows 7 and python 2.6.5

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

I am also having slight trouble understanding module packages as well, though I suspect it has something to do with not knowing how to configure PYTHONPATH or .pth files

Thanks =) ~Julius H. 


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100617/8d141ee4/attachment-0001.html>


More information about the Tutor mailing list