doit
doit copied to clipboard
Using getattr() instead of relying on .get() method
When trying to reuse the doit module in a standalone script that doesn't behave exactly like a dodo.py would, it's impossible to reuse doit.loader.load_doit_config() passing sys.modules[__name__] (the current "main" module), because it relies on the module object having a get method. That's not the case for the main module, it appears.
So for line 211 in the current version of loader.py I would suggest to replace:
doit_config = dodo_module.get('DOIT_CONFIG', {})
.... by:
doit_config = getattr(dodo_module, 'DOIT_CONFIG', {})
Environment
- OS: Ubuntu 16.04.6 LTS
- python version: 3.5.2
- doit version: 0.31.1
Thanks,
Oliver