-
Notifications
You must be signed in to change notification settings - Fork 37
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
ModuleNotFoundError - websockets.framing #133
Comments
According to the websockets library changelog, Maybe the author hasn't had the chance to fix it yet. Perhaps you can try installing an older version of the websockets library using virtualenv until it's fixed. |
After further investigations I have made the following changes to get the application to run... Websockets 9.1 has deprecated a number of unused API calls including some implemented in the websockets.framing module. The errors encountered when running with Websockets 9.1 can be cleared by commenting out imports in client.py import websockets logger = logging.getLogger(__name__) The problems identified in pysonofflan discover: too any open files #117 seem to be a ulimit problem which can be fixed by upping the ulimit e.g. ulimit -n 10000 10000 is an arbitrary value, pick something appropriately large (default is 256) With these changes in place pysonofflan appears to run but hangs performing some operations 2021-07-22 22:56:18,195 - info: Attempting to discover Sonoff LAN Mode devices on the local network, please wait... I have this issue too using latest version of Websockets (9.1) Python 3.9.6 running on Mac OSX 10.12.6 Marks-MBP:~ mark$ pysonofflan Reverting to Websockets 8.1 does not work due to other issues. |
Interesting, but I don't think removing the imports from From the library's changelog, it doesn't seem they were unused by them either, they're just making them private instead of exporting them publicly. It means the functionality still exists but is implemented in a way that is inaccessible for this project. Have you tried reverting to 8.1? Why did it not work? Have you tried virtualenv? |
I removed the import from websockets.framing on the basis of the changelog for Websockets here: https://websockets.readthedocs.io/en/stable/changelog.html#id2. The websockets.framing API have been deprecated-"The framing, handshake, headers, http, and uri modules in the websockets package are deprecated. These modules provided low-level APIs for reuse by other WebSocket implementations, but that never happened. Keeping these APIs public makes it more difficult to improve websockets for no actual benefit." The terms that would be imported in client.py at line 11 are resolved in pyc files in /usr/local/lib/python3.9/site-packages/websockets/pycache I have reverted all the way back to 6 with the same issue so I think the issue is likely to be a problem in my environment but I don't know why. I've compared my output with that expected and the resolution of IP address to device is not happening when pysonofflan hangs. In addition I now have some additional error messages after timeouts which give a clue: pysonofflan discover OK, this is my error. The Sonoff S26 device I am using is running r3.5.1 firmware which is incompatible with Pysonofflan. I don't have a device with V2 firmware on to test the above changes with. |
Hey, just wanted to say sorry for this, you're right in that I'm personally not doing any proactive efforts on this repo anymore as I don't actually have a sonoff with original firmware myself anymore (mine are all ESPHome or Tasmota now) so have no incentive to work on it. However, if anyone wants to be given maintainer permissions I'm more than happy to grant that, or if anyone submits a PR which just needs to be merged/released I'm happy to do that if someone tags me specifically asking me to do that - as long as there's an understanding that I can't test it myself! 😄 |
Description
Trying to work with pysonofflan either through the given script or through the framework it throws the following
ModuleNotFoundError
.What I Did
either
from pysonofflan import *
in pythonor
python -m pysonofflan discover
in bash/cmdI already tried reinstalling/restarting everything.
The text was updated successfully, but these errors were encountered: