Jun-06-2017, 02:39 AM
you need to put the save in the thread run method.
There is nothing that is communicating with the thread, so your write never receives any data.
And while at it, move the open there as well, and use the with open(...) as f:
so in the end run will look like (or similar to as I have not tested):
There is nothing that is communicating with the thread, so your write never receives any data.
And while at it, move the open there as well, and use the with open(...) as f:
so in the end run will look like (or similar to as I have not tested):
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)