Skip to content

Commit

Permalink
馃悰 Gracefully handle errors scanning /dev
Browse files Browse the repository at this point in the history
Solves an issue with Octo4a on some Android devices.
  • Loading branch information
foosel committed May 19, 2022
1 parent 26aac17 commit 89fbcfd
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/octoprint/util/comm.py
Expand Up @@ -198,10 +198,15 @@ def serialList():

else:
candidates = []
with os.scandir("/dev") as it:
for entry in it:
if regex_serial_devices.match(entry.name):
candidates.append(entry.path)
try:
with os.scandir("/dev") as it:
for entry in it:
if regex_serial_devices.match(entry.name):
candidates.append(entry.path)
except Exception:
logging.getLogger(__name__).exception(
"Could not scan /dev for serial ports on the system"
)

# additional ports
additionalPorts = settings().get(["serial", "additionalPorts"])
Expand Down

0 comments on commit 89fbcfd

Please sign in to comment.