Skip to content

Properly Catch exceptions when USB is Removed #54

@kb1lqc

Description

@kb1lqc

While running the faradayio-cli program with the lates development branch code of faradayio I obtain the following error when I remove the USB cable while the program is running. Note, this does not exit the program.

bryce@bryce-ubuntu:~/Documents/git/faradayio-cli$ sudo .venv/bin/faradayio-cli KB1LQC 1
[sudo] password for bryce: 
Executing faradayio-cli version 0.0.1
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/home/bryce/Documents/git/faradayio-cli/.venv/lib/python3.5/site-packages/serial/serialposix.py", line 501, in read
    'device reports readiness to read but returned no data '
serial.serialutil.SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/home/bryce/Documents/git/faradayio-cli/.venv/lib/python3.5/site-packages/faradayio/faraday.py", line 238, in run
    self.checkSerial()
  File "/home/bryce/Documents/git/faradayio-cli/.venv/lib/python3.5/site-packages/faradayio/faraday.py", line 211, in checkSerial
    for item in self.rxSerial(self._TUN._tun.mtu):
  File "/home/bryce/Documents/git/faradayio-cli/.venv/lib/python3.5/site-packages/faradayio/faraday.py", line 193, in rxSerial
    return(self._faraday.receive(length))
  File "/home/bryce/Documents/git/faradayio-cli/.venv/lib/python3.5/site-packages/faradayio/faraday.py", line 77, in receive
    ret = self._serialPort.read(length)
  File "/home/bryce/Documents/git/faradayio-cli/.venv/lib/python3.5/site-packages/serial/serialposix.py", line 509, in read
    raise SerialException('read failed: {}'.format(e))
serial.serialutil.SerialException: read failed: device reports readiness to read but returned no data (device disconnected or multiple access on port?)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions