revisiting the "What am I running on?" question
On Wed, Feb 20, 2019 at 1:59 AM songbird <songbird at anthive.com> wrote:
> MRAB wrote:
> > Don't use a bare except, it'll catch _any_ exception.
> that's ok with this code IMO, but i see your point.
Not really, no. It means that ANY bug (barring an outright syntax
error) inside the try block will silently move you on to the next
check, possibly after printing out the message. Suppose you misspelled
result = re.search("^/(tmp)|(var)|(usr)|(opt)|(home)", sysprobetmp)
print ("Result : -->" + result.group(0) + "<--\n")
It'll print out the result, bomb with a NameError, swallow the
NameError, and silently move on. The *only* times you should use a
bare except clause are with a "raise" inside it, or with a
log-and-return boundary marker (where "inner" code isn't allowed to
crash "outer" code, eg in a web app) - and the "log" part is