Reputation: 816
Adding config file to package is not a big deal. But when I upload package to pypi and install it, it's not possible to read logging config:
logging.config.fileConfig('logging.conf')
basically my modules don't find it because file is not in current working directory anymore. How can I address that?
Upvotes: 3
Views: 304
Reputation: 879621
If logging.conf
exists in the same directory as the file calling logging.config.fileConfig
, then you could use:
import os
logconf_file = os.path.join(os.path.dirname(__file__), 'logging.conf')
logging.config.fileConfig(logconf_file)
Upvotes: 3