[Clam-devel] how to import a python module from a relative path

Pau Arumi parumi at iua.upf.edu
Thu Dec 28 12:26:34 PST 2006


I've add a new module dependency (versionInfo) in 
CLAM/scripts/doDebianPackages.py and doSrcTarballs.py :

#!/usr/bin/python
import sys
sys.path.append("../scons/sconstools/")
from versionInfo import packageVersionFromSvn
...

as you see, versionInfo.py is not in the python path, but in a known 
(relative) path.
it works if I execute from the same dir:
$ ./doDebianPackages.py

but do not work from other dirs,
$ ../doDebianPackages.py

this is because relative paths takes the working dir as reference and 
not the file dir.

how can you refer in pyhton the file dir?
thanx

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.





More information about the clam-devel mailing list