I am a bit new to python and
import serial
import time
ser = serial.Serial('COM3', 9600, timeout=0)
while 1:
try:
print ser.readline()
time.sleep(1)
except ser.SerialTimeoutException:
print('Data could not be read')
time.sleep(1)
I installed pyserial. Why such a simple program like this is giving "invalid syntax" error at the line ser.readline(). Why has been python designed like this that it always makes beginners life difficult. Even here at stackoverflow why syntaxing code is so difficult? everyline has to be indented here.Why cant a simple do the job here.Well this is all together a different topic but why such a simple python program is creating errors?????
import serial import time ser = serial.Serial('COM5', 9600, timeout=0) print ser.readline()
is creating errors – Sriranjan Rasakatla Jun 02 '17 at 06:59