importing a module

phil hunt philh at comuno.freeserve.co.uk
Mon Nov 12 09:51:36 EST 2001


I have a project that is split into 2 directories, one for the 
main source, and the other for testing. I have 2 files:

   ./src/utility.py
   ./test/test_herbrip.py

My test program needs to import the utility.py module. At the moment
I am doing this using this code (in test_herbrip.py):

   sys.path.append(os.path.abspath("../src"))
   import utility

This works but looks a bit inelegant. Is there a better way 
of doing this?

-- 
*** Philip Hunt *** philh at comuno.freeserve.co.uk ***




More information about the Python-list mailing list