
Originally Posted by
bogdan.galiceanu
Could you please post the entire error exactly as you get it, with the little arrow and everything?
As requested, I am providing the entire code below. Please refer to the while loop towards the end for the supposed source of error.
Code:
import appuifw, e32, key_codes, graphics, socket
BLACK = (0,0,0)
def draw_point():
img.point((120,160), outline = YELLOW, width = 5)
def handle_redraw(rect):
if img: canvas.blit(img)
def handle_event(event):
ev = event['keycode']
if ev == key_codes.EKeyUpArrow:
draw_point()
handle_redraw(None)
def quit():
app_lock.signal()
img = None
canvas = appuifw.Canvas(redraw_callback = handle_redraw, event_callback = handle_event)
appuifw.app.body = canvas
appuifw.app.screen = 'full'
appuifw.app.exit_key_handler = quit
w, h = canvas.size
img = graphics.Image.new((w, h))
img = graphics.Image.open("E:\\Images\\canvas.jpg")
canvas.blit(img)
address, services = socket.bt_discover()
print "Discovered: %s, %s" % (address, services)
target = (address, services.values()[0])
conn = socket.socket(socket.AF_BT, socket.SOCK_STREAM)
conn.connect(target)
to_gps = conn.makefile("r", 0)
while True:
msg = to_gps.readline()
if msg.startswith("$GPGGA"):
gps_data = msg.split(",")
lat = gps_data[2]
#print lat
lat_compass = gps_data[3] #<-----------SyntaxError source
#print lat_compass
lon = gps_data[4]
#print lon
lon_compass = gps_data[5]
#print lon_compass
break
to_gps.close()
conn.close()
#print "You are now at latitude %s %s and longitude %s %s" % (lat, lat_compass, lon, lon_compass )
app_lock = e32.Ao_lock()
app_lock.wait()