From 37a607ba86ed17d8674952abadcad2f13d6fb1d3 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 14 Dec 2025 08:15:08 -0500 Subject: [PATCH] Update gps_client.py fix except --- gps_client.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/gps_client.py b/gps_client.py index 3f243c37..a11a454b 100644 --- a/gps_client.py +++ b/gps_client.py @@ -11,14 +11,14 @@ run this way: python3 example1.py.txt import gps # the gpsd interface module import time +mode = -1 +lat = 0 +lon = 0 +alt = 0 + try: session = gps.gps(mode=gps.WATCH_ENABLE) - - mode = -1 - lat = 0 - lon = 0 - alt = 0 start = time.perf_counter() @@ -60,10 +60,8 @@ try: # Got ^C, or fell out of the loop. Cleanup, and leave. session.close() - print("%d %.6f %.6f %.1f" % (mode, lat, lon, alt)) - exit(0) - return -except: - print("-1 0 0 0") +except: + print("%d %.6f %.6f %.1f" % (mode, lat, lon, alt)) exit(0) +