Skip to content
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

Libcoap depends on Aiocoap #475

Closed
MathiasMeuleman opened this issue Apr 12, 2022 · 6 comments · Fixed by #476
Closed

Libcoap depends on Aiocoap #475

MathiasMeuleman opened this issue Apr 12, 2022 · 6 comments · Fixed by #476

Comments

@MathiasMeuleman
Copy link

Where are you using pytradfri (eg stand-alone, Home Assistant etc)

Stand-alone python script

Version of pytradfri

v10.0.0

Backend used (aiocoap, libcoap)

libcoap

What type of environment are you in, eg Dockerized, Raspberry PI, VirtualBox, WiFi network (give as much details as possible)

Running python 3.10 on Linux machine

Expected behaviour

Imports are resolved properly, script runs as normal

Actual behaviour

ModuleNotFoundError: No module named 'aiocoap' when importing pytradfri.api.libcoap_api.APIFactory.

In this PR a dependency on aiocoap was added to libcoap, which breaks the import. Downgrading to v9 resolves the issue.

@ggravlingen
Copy link
Member

@MathiasMeuleman in what file is this error raised? Can you please provide the full stacktrace?

@MartinHjelmare
Copy link
Contributor

This is incorrectly typed:

output: Message, parse_json: bool = True

The libcoap api doesn't use aiocoap Message instances.

@MathiasMeuleman
Copy link
Author

Here is the full stacktrace

Traceback (most recent call last):
  File "[...]/script.py", line 4, in <module>
    from pytradfri.api.libcoap_api import APIFactory
  File "[~]/local/lib/python3.10/site-packages/pytradfri/api/libcoap_api.py", line 10, in <module>
    from aiocoap import Message
ModuleNotFoundError: No module named 'aiocoap'

As @MartinHjelmare said, the dependency on aiocoap which imports Message is the culprit.

@ggravlingen
Copy link
Member

Thanks, I’ll try to have a look at this over the weekend.

@ggravlingen
Copy link
Member

@MathiasMeuleman 10.0.1, including the fix, is on pypi now.

@MathiasMeuleman
Copy link
Author

Sorry for the late followup, but thank you for the quick responses and fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants