[vsipl++] [patch] Source configuration for package.py
Stefan Seefeld
stefan at codesourcery.com
Fri Apr 20 04:29:33 UTC 2007
Jules Bergmann wrote:
>
>>>
>>> Is there (and there must be, it is python!) a good way to include one
>>> configure file from another?
>>
>> from other_config import *
>
> If the file "other_config" is has a full path "a/b/c/other_config", and
> that path is stored in a variable cfg_path, how would you write this
> statement? Would this work:
>
> from '%s/other_config'%cfg_path import *
No. I would add cfg_path to the module search path:
import sys
sys.path.insert(0, cfg_path)
from other_config import *
(One has to be careful not to pick up other unwanted python modules
that happen to lie in the cfg_path directory, of course.)
Regards,
Stefan
--
Stefan Seefeld
CodeSourcery
stefan at codesourcery.com
(650) 331-3385 x718
More information about the vsipl++
mailing list