Skip to content

Commit bf348c1

Browse files
committed
Correct 1 more pre-commit error
1 parent ffa8575 commit bf348c1

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

examples/camera/code.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
UTC_OFFSET = os.getenv("UTC_OFFSET")
2727
TZ = os.getenv("TZ")
2828

29-
try:
30-
print(f"Connecting to {os.getenv('CIRCUITPY_WIFI_SSID')}")
31-
wifi.radio.connect(
32-
os.getenv("CIRCUITPY_WIFI_SSID"), os.getenv("CIRCUITPY_WIFI_PASSWORD")
29+
print(f"Connecting to {os.getenv('CIRCUITPY_WIFI_SSID')}")
30+
wifi.radio.connect(
31+
os.getenv("CIRCUITPY_WIFI_SSID"), os.getenv("CIRCUITPY_WIFI_PASSWORD")
3332
)
33+
if wifi.radio.connected:
3434
print(f"Connected to {os.getenv('CIRCUITPY_WIFI_SSID')}!")
3535
print("My IP address is", wifi.radio.ipv4_address)
3636
pool = socketpool.SocketPool(wifi.radio)
@@ -44,9 +44,8 @@
4444
ntp = adafruit_ntp.NTP(pool, server="pool.ntp.org", tz_offset=UTC_OFFSET // 3600)
4545

4646
rtc.RTC().datetime = ntp.datetime
47-
except Exception as e:
48-
print("Wifi error:", e)
49-
print("Time not set")
47+
else:
48+
print("Wifi failed to connect. Time not set.")
5049

5150
pycam = adafruit_pycamera.PyCamera()
5251
# pycam.live_preview_mode()

0 commit comments

Comments
 (0)