DEIS-Tools / CLAIRE-library

GNU General Public License v3.0
0 stars 0 forks source link

[Python] Close serial connection throws exception #31

Closed magoorden closed 1 month ago

magoorden commented 1 month ago
Traceback (most recent call last):
  File "<path>/env/lib/python3.9/site-packages/serial/serialposix.py", line 565, in read
    ready, _, _ = select.select([self.fd, self.pipe_abort_read_r], [], [], timeout.time_left())
OSError: [Errno 9] Bad file descriptor

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/threading.py", line 910, in run
    self._target(*self._args, **self._kwargs)
  File "<path>/DemonstratorSetUp/py_driver/driver.py", line 63, in _read_lines
    buf = self.ser.readlines()
  File "<path>/env/lib/python3.9/site-packages/serial/serialposix.py", line 581, in read
    raise SerialException('read failed: {}'.format(e))
serial.serialutil.SerialException: read failed: [Errno 9] Bad file descriptor
magoorden commented 1 month ago

Cause: the serial is closed, but the thread to read serial output into buffer is still trying to read the serial connection.