This example consists of three files: main.py, myConfig.py, and
newConfig.py.
I have told the Config constructor to suck up both config files on
initialization. Here's the program output:
~/show->python ./main.py
{'xGenDir': 'gen'}
Hi there!
I expected to see both the GenDir and xGenDir keys in localConfig.
# main.py
import sys
import os
from config import Config
def main():
pass
if __name__ == '__main__':
configObject = Config( ['myConfig.py', 'newConfig.py'] )
print configObject.get( 'localConfig' )
print configObject.get('foo')
# myConfig.py
class _dict(dict):
pass
# this should be able to be added to
localConfig = \
{
'default' : _dict(
GenDir = "gen"
)
}
foo = "Hi there!"
# newConfig.py
class _dict(dict):
pass
localConfig = \
{
'default' : _dict(
xGenDir = "gen"
)
}