Closed mtauberjr closed 3 years ago
please tell me a bit more about your operating system.
Same problem here on NixOS (both Py3.8 and Py3.9).
What is the expected behaviour from the following snippet when there's no config.py
in any of the locations defined in find_config
?
config_file = find_config()
spec = importlib.util.spec_from_file_location('config', config_file)
config = importlib.util.module_from_spec(spec)
spec.loader.exec_module(config)
In my case, config_file
is None (because there's no config.py in any of the expected locations), and so is spec
. Passing None
to module_from_spec
raises the aforementioned AttributeError
.
(if I copy etc/config.py.dist
to ~/.local/share/putio-automator/config.py
I can then do putio config init
which then writes the config file correctly)
I've duplicated this in a docker container. On it.
putio config init Traceback (most recent call last): File "/home/mtauberjr/.local/bin/putio", line 5, in
from putio_automator.cli import main
File "/home/mtauberjr/.local/lib/python3.9/site-packages/putio_automator/cli.py", line 16, in
config = importlib.util.module_from_spec(spec)
File "", line 562, in module_from_spec
AttributeError: 'NoneType' object has no attribute 'loader'