file / module / package - import problem

EuGeNe Van den Bulke eugene.vandenbulke at gmail.com
Wed May 30 16:22:13 EDT 2007


Hi there,

I have a "problem" which could be a bad design on my behalf but I am not 
sure so ...

I have a package WMI which contains a module hauteur.py which, when 
imported, load data from a file located in WMI/data/. In hauteur.py I 
call open('data/hauteur.yaml').

test.py
WMI/
     hauteur.py
     data/
         hauteur.yaml
     lot.py

It works well when hauteur is imported in lot.py but if I try import 
WMI.hauteur in test.py it doesn't work because it looks for the 
hauteur.yaml file in the "wrong" place.

Is there a way to tell a module in a package to look for a file in a 
specific place i.e. a within package location?

Thanks,

EuGeNe -- http://www.3kwa.com



More information about the Python-list mailing list