python - GPS Daemon on Raspberry Pi -


i'm trying implement sample script adafruit provides 1 of gps units designed raspberry pi. code follows:

==============

    import gps      # listen on port 2947 (gpsd) of localhost     session = gps.gps("localhost", "2947")     session.stream(gps.watch_enable | gps.watch_newstyle)      while true:         try:             report = session.next()             # wait 'tpv' report , display current time             # see report data, uncomment line below             # print report             if report['class'] == 'tpv':         if hasattr(report, 'time'):             print report.time         except keyerror:             pass         except keyboardinterrupt:             quit()         except stopiteration:             session = none             print "gpsd has terminated" 

==============

so add "#!/usr/bin/python -tt" top of "gps.py" file , "chmod u+x /home/pi/gps.py"

upon running this, though, following error , don't understand why:

==============

    pi@raspberrypi ~ $ /home/pi/gps.py     traceback (most recent call last):       file "/home/pi/gps.py", line 2, in <module>         import gps       file "/home/pi/gps.py", line 5, in <module>         session = gps.gps("localhost", "2947")     typeerror: 'module' object not callable 

==============

try renaming script other gps.py. python interpreter trying import rather gps.py script located in system library somewhere.


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -