[Tutor] python import problem

Alan Gauld alan.gauld at freenet.co.uk
Thu Aug 10 20:57:29 CEST 2006

>> The other way would be to add each folder to
>It works for me now:

>import sys
>import os.path
>sys.path.append(os.path.join(sys.path[0] ,"translate"))

That isn't using PYTHONPATH its updaing sys.path 
which is slightly different.. This way you need to do that 
for every program usi9ng your folder but if you modify 
the PYTHONPATH environment variable you only need 
to do it once and Python will add it to sys.path for you.


Alan Gauld
Author of the Learn to Program web site

More information about the Tutor mailing list