[Numpy-discussion] setting package path

Stefan van der Walt stefan at sun.ac.za
Thu Mar 2 08:14:04 CST 2006

On Tue, Feb 28, 2006 at 11:34:43PM -0600, Pearu Peterson wrote:
> >which calculates "somepath".  Which is wrong: the docstring, the code
> >or my interpretation?
> You have to read also following code:
>     d1 = 
>     os.path.join(d,'build','lib.%s-%s'%(get_platform(),sys.version[:3]))
>     if not os.path.isdir(d1):
>         d1 = os.path.dirname(d)  # <- here we get "somepath/.."
>     sys.path.insert(0,d1)


Thanks for pointing this out.  I was trying to figure out why my
module's tests didn't run when I did, for example:

$ python test_geom.py

But now I realise it is because typical package layout is
"somepath/some_dir/tests/test_file.py", not
"somepath/some_dir/test_file.py".  For example, we have

As a temporary workaround, set_local_path("../../..") works for me.


More information about the Numpy-discussion mailing list