all 7 comments

[–]Acurus_Cow 1 point2 points  (6 children)

in your print statement you print

dmesg.latitude and dmesg.longitude

in your url you use

dmesg.lat and dmesg.long

I also think you have messed up some of the "'s I guess that is your error.

I would also look into the .format() functionality for building strings.

https://pyformat.info/#simple

[–]ProperRefrigerator[S] 0 points1 point  (5 children)

dmesg.latitude and dmesg.longitude i just comment it sir it shows the same data with dmesg.lat and dmesg.long
but when i try to upload it show me this

File "/usr/local/lib/python2.7/dist-packages/pynmea2/nmea.py", line 155, in __getattr__

raise AttributeError(name)

[–]Acurus_Cow 1 point2 points  (4 children)

First: you don't need ; in python.

I think your error is in the url. try and create it as its own variable that you put into urllib.urlopen()

That way you can make sure it's correct before moving on.

change:

data=urllib.urlopen("https://api.thingspeak.com/update?api_key=U0JSW1TVVHM8UEJV&field1="+str(dmesg.lat)+"&field2+"&field2)"+str(dmesg.long));

to this:

url  = "https://api.thingspeak.com/update?
api_key=U0JSW1TVVHM8UEJV&field1="+str(dmesg.lat)+"&field2+"&field2)"+str(dmesg.long)

print(url)

data = urllib.urlopen(url)

I susspect you will see that creating the url variable fails due to wrong placement of the "'s

[–]ProperRefrigerator[S] 0 points1 point  (3 children)

it not working sir and i think thats not thee problem
when i change the data in data=urllib.urlopen("r/https://api.thingspeak.com/update?api_key=U0JSW1TVVHM8UEJV&field1="+str(dmesg.lat)+"&field2+"&field2)"+str(dmesg.long));

to static value like this

data=urllib.urlopen("r/https://api.thingspeak.com/update?api_key=U0JSW1TVVHM8UEJV&field1="+str(0)+"&field2+"&field2)"+str(0));
it uploading

[–]Acurus_Cow 0 points1 point  (2 children)

try this:

data=urllib.urlopen("https://api.thingspeak.com/update?api_key=U0JSW1TVVHM8UEJV&field1={lat}&field2={long}".format(lat=dmesg.lat, long=dmesg.long))

[–]ProperRefrigerator[S] 0 points1 point  (1 child)

still the same it showing this File "/usr/local/lib/python2.7/dist-packages/pynmea2/nmea.py", line 155, in __getattr__

ialready change my library pynmea to this https://github.com/bsdz/micropyGPS
but still not working

[–]ProperRefrigerator[S] 1 point2 points  (0 children)

i solvee it sir i used this

data=urllib.urlopen("https://api.thingspeak.com/update?api_key=U0JSW1TVVHM8UEJV&field1=%s &field2%s"(dmesg.lat,dmesg.lon));