python - SyntaxError: unexpected character after line continuation character -
this easy problem experienced in python. not , need use little piece of code , never use again anywhere else asking stackoverflow gods mercy. attempting run terminal. cd desktop , run ourfleet.py.rtf. error dreaded: file "ourfleet.py.rtf", line 1 {\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 ^ syntaxerror: unexpected character after line continuation character
ultimate first time python user last time python user need work. thumbs best answer. have newest python version installed & running macbook.
import serial import time import requests import json firebase_url = 'https://ourfleet.firebaseio.com' #connect serial port communication ser = serial.serial(‘dev/tty.wchusbserial410’, 4800, timeout=0) #setup loop send gps values @ fixed intervals #in seconds fixed_interval = 10 while 1: try: #gps value obtained arduino + lm35 temp sensor gps_c = ser.readline() #current time , date time_hhmmss = time.strftime("%h:%m:%s") date_mmddyyyy = time.strftime("%d/%m/%y") #current location name gps_location = "doug c." print “gps_c + ',' + time_hhmmss + ',' + date_mmddyyyy + ',' + gps_location” #insert record data = {'date':date_mmddyyyy,'time':time_hhmmss,'value’:gps_c} result = requests.post(firebase_url + "/" + gps_location + "/gps.json", data=json.dumps(data)) #insert record print “"record inserted. result code = " + str(result.status_code) + "," + result.text” time.sleep(fixed_interval) except ioerror: print('error! went wrong.') time.sleep(fixed_interval)
you've saved script rich text format document. don't that. save plain text.
while you're @ it, don't use smart quotes since python doesn't understand them.
Comments
Post a Comment