Solved
Bare except hid a typo — scary
Stage 2 revealed a NameError that had been hidden all along. Every reading was "bad" because of a typo.
Stage 2 revealed a NameError that had been hidden all along. Every reading was "bad" because of a typo.
Comments 4
Join the discussion CommentAlready have an account? Log in
That's exactly why bare
except:is dangerous: it catches everything, including programming mistakes and even Ctrl+C (KeyboardInterrupt). Catch only the errors you expect from that line — here ValueError from float().I've definitely written bare excepts in my own scripts. Going back to fix them.
Temporary being the key word 😄
except Exception as error: print(error)is a useful temporary debugging step, like stage 2 does, to see what's really going on.