Created
February 20, 2014 07:09
-
-
Save yuuichi-fujioka/9108421 to your computer and use it in GitHub Desktop.
Example of load python based config file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
v = { | |
'foo': 'bar' | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
import time | |
def load_conf_and_print(): | |
_globals = {} | |
_locals = {} | |
execfile('conf.py', _globals, _locals) | |
print(_locals['v']['foo']) | |
def main(): | |
while True: | |
load_conf_and_print() | |
time.sleep(1) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment