Open shuttle1987 opened 4 years ago
This is my attempt at getting python to try multiple ports (i.e., '/devttylUSB0') without throwing an error after the first one. I tried using mutilple bare exceptions but python didn't let me so I through in arbitrary exception "NameError".
It did the job! Lol. Not the right way.
https://github.com/JamesDevJim/game-zulu/blob/4b46243499803992d0ef07bb856fb49bb8f72240/shared/control.py#L13-L23
Catching
NameError
here seems like it couldn't possibly be what we want to be doing here sinceNameError
is an error when Python can't find a name of a variable in the current scope and this particular code doesn't deal with any dynamic variable names. If there somehow was a name error in the firsttry
bloc we will run into it again in the exception handling clause because the code looks identical,