[Pythonmac-SIG] newbie file path question

Just van Rossum just@letterror.com
Sun, 15 Jul 2001 22:27:53 +0200


Scott Griffitts wrote:

> How do I import a .py file outside of the Python directory?
> 
> for example, if I want to import test1.py from the following path:
> 
> HD:folder1:folder2:folder3:test.py
> 
> how do I word the file path between import and test.py?

You have to add HD:folder1:folder2:folder3: to the sys.path (the module search
search path) default settings with EditPythonPrefs. Just add your folder path as
a new line at the end (don't add $(PYTHON), as that's a magic prefix meaning the
python installation folder).

Just