Skip to content

Handle ValueError during socket device shutdown - #65

Merged
ajschmidt8 merged 1 commit into
nutechsoftware:masterfrom
jjlawren:handle_valueerror
Mar 9, 2025
Merged

ajschmidt8 merged 1 commit into
nutechsoftware:masterfrom
jjlawren:handle_valueerror

Conversation

@jjlawren

Copy link
Copy Markdown
Contributor

When the socket is closed down unexpectedly a ValueError can be thrown while waiting for a message:

2022-02-05 13:49:03 ERROR (Thread-3) [root] Uncaught thread exception
Traceback (most recent call last):
  File "/usr/lib/python3.9/threading.py", line 973, in _bootstrap_inner
    self.run()
  File "/srv/homeassistant/venv/lib/python3.9/site-packages/alarmdecoder/devices/base_device.py", line 148, in run
    self._device.read_line(timeout=self.READ_TIMEOUT)
  File "/srv/homeassistant/venv/lib/python3.9/site-packages/alarmdecoder/devices/socket_device.py", line 323, in read_line
    read_ready, _, _ = select.select([self._device], [], [], 0.5)
ValueError: file descriptor cannot be a negative integer (-1)

Fixes #64

@edrikk edrikk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ajschmidt8
Given that you have commit access, I wanted to flag a few PRs/changes that I've been running cleanly for a couple of years. These changes will also enable updating/correcting the requirements.txt file.
I'll using this same "approve" comment across these items.

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 this pull request may close these issues.

ValueError: file descriptor cannot be a negative integer (-1)

4 participants