Thanks.
I put this in the script as below and ran but still get nothing printed to the file and it does not open the file locations.csv :
I put this in the script as below and ran but still get nothing printed to the file and it does not open the file locations.csv :
from gps import * import time import threading def run(self): global gpsd while gpsp.running: with open("locations.csv","w") as f: gpsd.next() f.write('{}, {}\n'.format(gpsd.fix.longitude, gpsd.fix.latitude)) # print (gpsd.fix.longitude) # print (gpsd.fix.latitude)