ssato / python-anyconfig

Python library provides common APIs to load and dump configuration files in various formats
MIT License
278 stars 31 forks source link

AttributeError: module 'simplejson' has no attribute 'loads' #113

Closed ssbarnea closed 4 years ago

ssbarnea commented 5 years ago
  File "/Users/ssbarnea/os/molecule/molecule/config.py", line 24, in <module>
    import anyconfig
  File "/Users/ssbarnea/os/molecule/.tox/doc/lib/python3.7/site-packages/anyconfig/__init__.py", line 25, in <module>
    from .api import (
  File "/Users/ssbarnea/os/molecule/.tox/doc/lib/python3.7/site-packages/anyconfig/api.py", line 101, in <module>
    from anyconfig.backends import Parsers
  File "/Users/ssbarnea/os/molecule/.tox/doc/lib/python3.7/site-packages/anyconfig/backends.py", line 21, in <module>
    import anyconfig.backend.json
  File "/Users/ssbarnea/os/molecule/.tox/doc/lib/python3.7/site-packages/anyconfig/backend/json/__init__.py", line 24, in <module>
    from .simplejson import Parser as SimpleJsonParser
  File "/Users/ssbarnea/os/molecule/.tox/doc/lib/python3.7/site-packages/anyconfig/backend/json/simplejson.py", line 47, in <module>
    class Parser(BaseParser):
  File "/Users/ssbarnea/os/molecule/.tox/doc/lib/python3.7/site-packages/anyconfig/backend/json/simplejson.py", line 55, in Parser
    _load_from_string_fn = anyconfig.backend.base.to_method(json.loads)
AttributeError: module 'simplejson' has no attribute 'loads'

Installing simplejson package is addressing this issue but this is still a bug in anyconfig, initially reported at https://github.com/ansible/molecule/issues/2421

ssato commented 5 years ago

Thanks a lot for your report!

I'm not sure what's causing the issue but I think it might be that wrong 'simplejson' (anyconfig.backend.json.simplejson) was loaded instead of the wanted simplejson.

I renamed it just in case in the commit 5b9770e. I'll merge it and related changes and release the next version if it works. Otherwise, could you please let me know how to reproduce your problem to look into?

ssato commented 4 years ago

It should be closed with the latest release 0.9.11 but if you have any further problems on this, please re-open this issue.