config.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # -*- coding: utf-8 -*-
  2. """Default config variables
  3. Don't overwrite here, because this file is in the version control
  4. Create a localconfig.py file for your own deviating config variables.
  5. There you can overwrite the variables defined here, and define additional ones.
  6. """
  7. import os
  8. import logging
  9. home = os.environ.get("HOME")
  10. OBJSIMPY_DIR = os.path.dirname(__file__)
  11. OBJSIM_DIR = os.path.normpath(os.path.join(OBJSIMPY_DIR, '..', '..'))
  12. MOVIE_DIR = os.path.join(OBJSIM_DIR, 'data', 'movies')
  13. SIMDATA_BASE_DIR = os.path.join(home, 'data', 'sim')
  14. TESTDATA_BASE_DIR = os.path.join(OBJSIMPY_DIR, '..', 'test', 'data')
  15. MIN_DELAY = 0.25
  16. # For infos on logging see:
  17. # https://docs.python.org/2/howto/logging.html
  18. # http://victorlin.me/posts/2012/08/26/good-logging-practice-in-python
  19. # create logger
  20. logger = logging.getLogger('objsimpy')
  21. logger.setLevel(logging.ERROR)
  22. # create console handler and set level to debug
  23. ch = logging.StreamHandler()
  24. ch.setLevel(logging.DEBUG)
  25. # create formatter
  26. formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
  27. # add formatter to ch
  28. ch.setFormatter(formatter)
  29. # add ch to logger
  30. logger.addHandler(ch)
  31. try:
  32. from localconfig import *
  33. except ImportError:
  34. pass