-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AttributeError: 'property' object has no attribute 'Layer' #517
Comments
What version of python is this?
The line that they are complaining about is:
def add_layer(self, label: str, layer: typing.Union[str, typing.Dict,
'pebble.Layer'], *,
combine: bool = False):
Which is just a type annotation and not the code. It seems that
the @Property line earlier in the code is confusing the annotations parsing.
…On Thu, Apr 22, 2021 at 10:37 AM Emin AKTAS ***@***.***> wrote:
Hello,
With the new release of the package (1.2.0) below error started while
deploying the charm
unit-charm--0: 13:39:07 WARNING unit.charm-/0.install Traceback (most recent call last):
unit-charm--0: 13:39:07 WARNING unit.charm-/0.install File "./src/charm.py", line 5, in <module>
unit-charm--0: 13:39:07 WARNING unit.charm-/0.install from ops.charm import CharmBase
unit-charm--0: 13:39:07 WARNING unit.charm-/0.install File "/var/lib/juju/agents/unit-charm--0/charm/venv/ops/__init__.py", line 43, in <module>
unit-charm--0: 13:39:07 WARNING unit.charm-/0.install from . import charm # noqa: F401 (imported but unused)
unit-charm--0: 13:39:07 WARNING unit.charm-/0.install File "/var/lib/juju/agents/unit-charm--0/charm/venv/ops/charm.py", line 22, in <module>
unit-charm--0: 13:39:07 WARNING unit.charm-/0.install from ops import model
unit-charm--0: 13:39:07 WARNING unit.charm-/0.install File "/var/lib/juju/agents/unit-charm--0/charm/venv/ops/model.py", line 1017, in <module>
unit-charm--0: 13:39:07 WARNING unit.charm-/0.install class Container:
unit-charm--0: 13:39:07 WARNING unit.charm-/0.install File "/var/lib/juju/agents/unit-charm--0/charm/venv/ops/model.py", line 1053, in Container
unit-charm--0: 13:39:07 WARNING unit.charm-/0.install combine: bool = False):
unit-charm--0: 13:39:07 WARNING unit.charm-/0.install File "/usr/lib/python3.5/typing.py", line 552, in __getitem__
unit-charm--0: 13:39:07 WARNING unit.charm-/0.install dict(self.__dict__), parameters, _root=True)
unit-charm--0: 13:39:07 WARNING unit.charm-/0.install File "/usr/lib/python3.5/typing.py", line 512, in __new__
unit-charm--0: 13:39:07 WARNING unit.charm-/0.install for t2 in all_params - {t1} if not isinstance(t2, TypeVar)):
unit-charm--0: 13:39:07 WARNING unit.charm-/0.install File "/usr/lib/python3.5/typing.py", line 512, in <genexpr>
unit-charm--0: 13:39:07 WARNING unit.charm-/0.install for t2 in all_params - {t1} if not isinstance(t2, TypeVar)):
unit-charm--0: 13:39:07 WARNING unit.charm-/0.install File "/usr/lib/python3.5/typing.py", line 190, in __subclasscheck__
unit-charm--0: 13:39:07 WARNING unit.charm-/0.install self._eval_type(globalns, localns)
unit-charm--0: 13:39:07 WARNING unit.charm-/0.install File "/usr/lib/python3.5/typing.py", line 177, in _eval_type
unit-charm--0: 13:39:07 WARNING unit.charm-/0.install eval(self.__forward_code__, globalns, localns),
unit-charm--0: 13:39:07 WARNING unit.charm-/0.install File "<string>", line 1, in <module>
unit-charm--0: 13:39:07 WARNING unit.charm-/0.install AttributeError: 'property' object has no attribute 'Layer'
unit-charm--0: 13:39:07 ERROR juju.worker.uniter.operation hook "install" (via hook dispatching script: dispatch) failed: exit status 1
unit-charm--0: 13:39:07 INFO juju.worker.uniter awaiting error resolution for "install" hook
unit-charm--0: 13:39:12 INFO juju.worker.uniter awaiting error resolution for "install" hook
Thanks
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#517>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABRQ7M47FI5VVZSKD3XKR3TKAYB7ANCNFSM43MTIOXQ>
.
|
Thanks for the quick response. I am using Python 3.5.2 on Ubuntu1604. Currently, I switched to the older version(ops==1.0.1).
|
So we do run a regression test on Python 3.5, but our test infrastructure
is 3.5.10. Is it possible for you to test with a newer version of Python?
That feels like the sort of thing they might have fixed upstream.
https://github.com/canonical/operator/runs/2395784540
On Thu, Apr 22, 2021 at 11:24 AM Emin AKTAS ***@***.***>
wrote:
… Thanks for the quick response. I am using Python 3.5.2 on Ubuntu1604.
Currently, I switched to the older version(ops==1.0.1).
What version of python is this? The line that they are complaining about
is: def add_layer(self, label: str, layer: typing.Union[str, typing.Dict,
'pebble.Layer'],
*, combine: bool = False): Which is just a type annotation and not the
code. It seems that the @Property <https://github.com/Property> line
earlier in the code is confusing the annotations parsing. …
<#m_-1131703211203150840_> On Thu, Apr 22, 2021 at 10:37 AM Emin AKTAS @.***>
wrote: Hello, With the new release of the package (1.2.0) below error
started while deploying the charm unit-charm--0: 13:39:07 WARNING
unit.charm-/0.install Traceback (most recent call last): unit-charm--0:
13:39:07 WARNING unit.charm-/0.install File "./src/charm.py", line 5, in
unit-charm--0: 13:39:07 WARNING unit.charm-/0.install from ops.charm import
CharmBase unit-charm--0: 13:39:07 WARNING unit.charm-/0.install File
"/var/lib/juju/agents/unit-charm--0/charm/venv/ops/*init*.py", line 43,
in unit-charm--0: 13:39:07 WARNING unit.charm-/0.install from . import
charm # noqa: F401 (imported but unused) unit-charm--0: 13:39:07 WARNING
unit.charm-/0.install File
"/var/lib/juju/agents/unit-charm--0/charm/venv/ops/charm.py", line 22, in
unit-charm--0: 13:39:07 WARNING unit.charm-/0.install from ops import model
unit-charm--0: 13:39:07 WARNING unit.charm-/0.install File
"/var/lib/juju/agents/unit-charm--0/charm/venv/ops/model.py", line 1017, in
unit-charm--0: 13:39:07 WARNING unit.charm-/0.install class Container:
unit-charm--0: 13:39:07 WARNING unit.charm-/0.install File
"/var/lib/juju/agents/unit-charm--0/charm/venv/ops/model.py", line 1053, in
Container unit-charm--0: 13:39:07 WARNING unit.charm-/0.install combine:
bool = False): unit-charm--0: 13:39:07 WARNING unit.charm-/0.install File
"/usr/lib/python3.5/typing.py", line 552, in *getitem* unit-charm--0:
13:39:07 WARNING unit.charm-/0.install dict(self.*dict*), parameters,
_root=True) unit-charm--0: 13:39:07 WARNING unit.charm-/0.install File
"/usr/lib/python3.5/typing.py", line 512, in *new* unit-charm--0:
13:39:07 WARNING unit.charm-/0.install for t2 in all_params - {t1} if not
isinstance(t2, TypeVar)): unit-charm--0: 13:39:07 WARNING
unit.charm-/0.install File "/usr/lib/python3.5/typing.py", line 512, in
unit-charm--0: 13:39:07 WARNING unit.charm-/0.install for t2 in all_params
- {t1} if not isinstance(t2, TypeVar)): unit-charm--0: 13:39:07 WARNING
unit.charm-/0.install File "/usr/lib/python3.5/typing.py", line 190, in
*subclasscheck* unit-charm--0: 13:39:07 WARNING unit.charm-/0.install
self._eval_type(globalns, localns) unit-charm--0: 13:39:07 WARNING
unit.charm-/0.install File "/usr/lib/python3.5/typing.py", line 177, in
_eval_type unit-charm--0: 13:39:07 WARNING unit.charm-/0.install eval(self.
*forward_code*, globalns, localns), unit-charm--0: 13:39:07 WARNING
unit.charm-/0.install File "", line 1, in unit-charm--0: 13:39:07 WARNING
unit.charm-/0.install AttributeError: 'property' object has no attribute
'Layer' unit-charm--0: 13:39:07 ERROR juju.worker.uniter.operation hook
"install" (via hook dispatching script: dispatch) failed: exit status 1
unit-charm--0: 13:39:07 INFO juju.worker.uniter awaiting error resolution
for "install" hook unit-charm--0: 13:39:12 INFO juju.worker.uniter awaiting
error resolution for "install" hook Thanks — You are receiving this because
you are subscribed to this thread. Reply to this email directly, view it on
GitHub <#517 <#517>>, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/AABRQ7M47FI5VVZSKD3XKR3TKAYB7ANCNFSM43MTIOXQ
.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#517 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABRQ7O5AO23FTAMMGTF2STTKA5RJANCNFSM43MTIOXQ>
.
|
The default version of Python for Xenial(Ubuntu1604) is 3.5.2. So, this could be a problem for someone who uses lxd-cloud. My case: juju bootstrap lxd
juju add-model testing localhost/localhost
juju deploy ./mycharm.charm It automatically downloads the Ubuntu image for Xenial and installs the charm. This case it will fail |
Note that we can try to fix this for 3.5.2 and 1.2.1. However, we will be
dropping support for Xenial and Python 3.5 relatively soon. (Probably it
will be dropped in 1.3).
The issue is that even PyPi is dropping support for Python 3.5 (they had
originally claimed they would drop it in Jan 2021). And Pip itself does
have: pypa/pip#9189 which pulls 3.5 support out (in
Dec 2020).
There are several things that we would like to have from python 3.6+ (f
strings, better type annotations, more complete pathlib handling so you
don't have to str(path) on every stdlib call.)
John
=:->
…On Thu, Apr 22, 2021 at 11:47 AM Emin AKTAS ***@***.***> wrote:
The default version of Python for Xenial(Ubuntu1604) is 3.5.2. So, this
could be a problem for someone who uses lxd-cloud.
My case:
juju bootstrap lxd
juju add-model testing localhost/localhost
juju deploy ./mycharm.charm
It automatically downloads the Ubuntu image for Xenial and installs the
charm. This case it will fail
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#517 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABRQ7IZK47VERK3M4LDC2DTKBAKBANCNFSM43MTIOXQ>
.
|
Unfortunately, We still use Xenial in some cases. ¯(°_o)/¯. Emin |
@eminaktas I've fixed this on |
Good to know, thanks for the report @eminaktas. |
Fixes pip install wheelhouse failure on Hirsute. canonical/layer-basic#193 Also pin ops!=1.2.0 due to that version of the ops (operator) library not working with xenial [1]. [1] canonical/operator#517 Change-Id: Ia8194247d5d553e72e694b4e2c649bd418d2adf4
* Update charm-vault from branch 'master' to c4f0c880a3d11a860fb5f408e0ce1150e4426bdb - Merge "Rebuild for picking up layer-basic#193" - Rebuild for picking up layer-basic#193 Fixes pip install wheelhouse failure on Hirsute. canonical/layer-basic#193 Also pin ops!=1.2.0 due to that version of the ops (operator) library not working with xenial [1]. [1] canonical/operator#517 Change-Id: Ia8194247d5d553e72e694b4e2c649bd418d2adf4
Hello,
With the new release of the package (1.2.0) below error started while deploying the charm. I am not sure what causes this error but this happens at the very beginning of the code that importing the from
ops.charm import CharmBase
Thanks
The text was updated successfully, but these errors were encountered: