AttributeError: 'ConfigData' object has no attribute 'get' in Python 3.5.2 (Xenial)
See original GitHub issueIt appears that typing.Mapping
works a bit different in Python version 3.5.2 than other higher versions. I got the following error when running some functional tests on xenial, but it works on bionic.
Traceback (most recent call last):
File "./src/charm.py", line 310, in <module>
main(CloudstatsCharm)
File "/var/lib/juju/agents/unit-cloudstats-0/charm/venv/ops/main.py", line 431, in main
_emit_charm_event(charm, dispatcher.event_name)
File "/var/lib/juju/agents/unit-cloudstats-0/charm/venv/ops/main.py", line 142, in _emit_charm_event
event_to_emit.emit(*args, **kwargs)
File "/var/lib/juju/agents/unit-cloudstats-0/charm/venv/ops/framework.py", line 316, in emit
framework._emit(event)
File "/var/lib/juju/agents/unit-cloudstats-0/charm/venv/ops/framework.py", line 784, in _emit
self._reemit(event_path)
File "/var/lib/juju/agents/unit-cloudstats-0/charm/venv/ops/framework.py", line 857, in _reemit
custom_handler(event)
File "./src/charm.py", line 145, in on_config_changed
self.helper.configure()
File "/var/lib/juju/agents/unit-cloudstats-0/charm/lib/lib_cloudstats.py", line 242, in configure
self.render_config()
File "/var/lib/juju/agents/unit-cloudstats-0/charm/lib/lib_cloudstats.py", line 118, in render_config
context.update(self._openstack_context)
File "/var/lib/juju/agents/unit-cloudstats-0/charm/lib/lib_cloudstats.py", line 146, in _openstack_context
cert_config = self.charm_config.get("openstack_cert", None)
AttributeError: 'ConfigData' object has no attribute 'get'
Also see a simple code snippet
Python 3.5.2 (default, Jan 26 2021, 13:30:48)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from typing import Mapping
>>> class foo(Mapping[str, str]):
... def __init__(self):
... self.data = {"greeting": "Hello World"}
... def __len__(self):
... return len(self.data)
... def __iter__(self):
... return iter(self.data)
... def __getitem__(self, key: str) -> str:
... return self.data[key]
...
>>> f = foo()
>>> f.get("greeting")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'foo' object has no attribute 'get'
>>> f["greeting"]
'Hello World'
Issue Analytics
- State:
- Created a year ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
'Config' object has no attribute 'jax_experimental_name_stack'
Schreenshot of the error message. I'm trying to run Alphafold on Google runtime, and I'm getting this error:
Read more >2019-January.txt - Python mailing list
In many recent polls I keep seeing Python getting an increasing share of ... AttributeError: 'Popen' object has no attribute 'read' Hello, ...
Read more >Release 2.25.0 MMDetection Authors - Read the Docs
If you install mmdetection with pip, open you python interpreter and ... Fix bug of 'PAFPN has no attribute extra_convs_on_inputs' (#4235).
Read more >mozilla-release: changeset 682745 ... - Mercurial
``coverage run --debug=sys`` would fail with an AttributeError. ... ``AttributeError: 'module' object has no attribute '__path__'``, ...
Read more >attributeerror: 'settings' object has no attribute 'root_urlconf'
A string representing the full Python import path to your root URLconf. For example: "mydjangoapps.urls". Can be overridden on a per-request basis by...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It’s very strange how “they” thought it was a good idea to change this in a patch version (between 3.5.2 and 3.5.3)!
Yeah - let’s cover all four.