Mon 18 Aug 2014 11:08:15 PM UTC, original submission:
line 6 in misc.py breaks the build in time function, when using gps.py as in the examples.
Try this
-------------------
from time import time # For delays
#from gps import *
print time
print time()
-----------------------
output:
<built-in function time>
1408401515.16
now uncomment the second line
-------------------
from time import time # For delays
from gps import *
print time
print time()
-----------------------
output:
<module 'time' (built-in)>
Traceback (most recent call last):
File "/home/martin/src/gps-bug.py", line 3, in <module>
print time()
TypeError: 'module' object is not callable
One workaround is to do this
--------------------
from time import time # For delays
from gps import gps, WATCH_ENABLE
print time
print time()
------------------
This would alow be to use this function:
gpsd = gps(mode=WATCH_ENABLE)
But I would have to explicitly import every symbol i need, getting ugly.
A better solution is for gps.py to pack the defines in a class, like this:
class gpssetup:
ONLINE_SET = (1<<1)
TIME_SET = (1<<2)
TIMERR_SET = (1<<3)
LATLON_SET = (1<<4)
ALTITUDE_SET = (1<<5)
SPEED_SET = (1<<6)
TRACK_SET = (1<<7)
This would alow be to use this function:
------------------
from time import time # For delays
from gps import gps, gpssetup
gpsd = gps(mode=gpssetup.WATCH_ENABLE)
------------------
Or as I prefer add the defines to the gps class alowing this
------------------
from time import time # For delays
from gps import gps
gpsd = gps(mode=gps.WATCH_ENABLE)
------------------
NB: this is the second time I write this bug report, first time i wrote it entered the title og orells novel, but apparantly it should not be the title as written on the cover of his book (acording to wikipedia) in letters but the number the the letter spell. To I was presented with an error followed by a nice clean form, ready to start all over.
|