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

David García Garzón dgarcia at iua.upf.edu
Thu Dec 28 17:03:16 PST 2006

which gives the path of the current script, then you can get the relative path 
to this one.

On Thursday 28 December 2006 21:26, Pau Arumi wrote:
> 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

David García Garzón
(Work) dgarcia at iua dot upf anotherdot es
(Home) vokimon at telefonica adot net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.clam-project.org/pipermail/clam-devel-clam-project.org/attachments/20061229/a13a67c2/attachment.sig>

More information about the clam-devel mailing list