-
Notifications
You must be signed in to change notification settings - Fork 13
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
Python 3.9 breaks the package? #15
Comments
See construct/construct#930 PR to construct. This seems to be a behavior change in Python's importlib. See also https://issuetracker.google.com/issues/170125513 |
This issue is fixed by adding |
Which version of ‘construct’ you have installed? There would be a lot of attention to this problem from homeassistant community as my lib and a lot of others use ‘construct’ as dependency. |
If this is the fix then this import can be anywhere? Not only in vallox/construct libs? |
It's v2.10.67. |
I'm not savvy at all, but I'd figure that it's not global so if you use it inside the module, you have to import it there. |
I'm also having the same problem, and it makes no sense at all. I'm on macOS 11.6.3 at the moment and trying to run a simple test client with import asyncio
from vallox_websocket_api import Vallox
client = Vallox('1.2.3.4')
async def run():
profile = await client.get_profile()
print("Profile: %s" % profile)
asyncio.get_event_loop().run_until_complete(run()) If a manually add the changes from construct/construct#930 to |
I can not reproduce. I test the lib in 5 different python versions:
|
My guess is that it has somthing to do with either the OS, the surrounding environment or how the Python binary/package is built/packaged. Did you try it with the minimal example I provided too? And which OS did you test it on? I added a bit more info here too: construct/construct#930 (comment) |
Can you run tests? I run the lib on Ubuntu server in venv Python 3.8.10 to hook the unit up with MQTT. |
Interesting, the tests do work. Can't remember where I read it, but someone speculated that it might be enough that one file loads |
In my case, I also got it working if I ran the script from IDLE. If I ran it using the command line, it didn't work. That's what puzzled me a lot. |
On my Mac tests do work in IDE (PyCharm) and from console. |
@yozik04 what about this simple test script, does it also work on your Mac? And how is Python installed in that case? import asyncio
from vallox_websocket_api import Vallox
client = Vallox('1.2.3.4')
async def run():
profile = await client.get_profile()
print("Profile: %s" % profile)
asyncio.get_event_loop().run_until_complete(run()) |
Works fine:
|
websockets==9.1 |
@slovdahl, @Boulder08 I have asked construct devs to merge PR to fix this problem. Please verify. Should be fixed in construct 2.10.68. |
Great, I can confirm that it starts working after running |
Great! Happy to help. |
I've installed Python v3.9 and after that, launching a scheduled Python script to collect data from the Vallox API fails with this error:
This is the code I've tested it with:
It's strange that if I open the script in IDLE and launch it from there, no problems.
All the old Python versions are uninstalled.
The text was updated successfully, but these errors were encountered: