I am trying to receive some data from a NEO M6 GPS module in my Raspberry Pi 3 and I have already verified that there is communication between them. I have this script in python but it does not work for me. I do not understand python.
import gps session = gps.gps("localhost", "2947") session.stream(gps.WATCH_ENABLE | gps.WATCH_NEWSTYLE) x= 1 while x == 1: report = session.next() if report['class'] == 'TPV': if hasattr(report, 'time'): print 'Hora: ' + str(report.time) if hasattr(report, 'lat'): print 'Latitud: ' + str(report.lat) if hasattr(report, 'lon'): print 'Longitud: ' + str(report.lon) if hasattr(report, 'speed'): print 'Velocidad: ' + str(report.speed) if hasattr(report, 'track'): print 'Rumbo: ' + str(report.track) if hasattr(report, 'head'): print report.head x= 0
But when I created the .py and executed it, my Raspberry told me this
File"testgps.py", line 10 if hasattr(report, 'time'): ^ IndentationError: expected an indented block
How can I get this program or a similar one to work for me?
The program was taken from the Raspberry forum and it seems that the people did work for it. I have to say that I have installed everything they said was necessary. Thank you very much for your time.