Skip to content

Commit

Permalink
better err message for hivemq-com-chain.der not found
Browse files Browse the repository at this point in the history
  • Loading branch information
sgbaird committed Feb 14, 2024
1 parent a27ebda commit a600c20
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/public_mqtt_sdl_demo/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,16 @@
ntptime.host = "time.google.com"
ntptime.settime()

print("Obtaining CA Certificate")
with open("hivemq-com-chain.der", "rb") as f:
cacert = f.read()
f.close()
der_fname = "hivemq-com-chain.der"
try:
print("Obtaining CA Certificate")
with open(der_fname, "rb") as f:
cacert = f.read()
except FileNotFoundError as e:
print(get_traceback(e))
print(
f"{der_fname} file not found. For versions 0.4.2+, this file is required. Please upload this to the Pico W directly from the unzipped folder or at https://github.com/sparks-baird/self-driving-lab-demo/blob/main/src/public_mqtt_sdl_demo/hivemq-com-chain.der (permalink: https://github.com/sparks-baird/self-driving-lab-demo/blob/a27ebda49f7307fa17fca9e8b8531c59585b6b98/src/public_mqtt_sdl_demo/hivemq-com-chain.der)"
)

logfile.close()
os.dupterm(None)
Expand Down

0 comments on commit a600c20

Please sign in to comment.