Did your try without
One more thing I have noticed - you don't actually initialize
\r
? AFAIK, only Windows uses \r\n
as EOL sequenceOne more thing I have noticed - you don't actually initialize
parity
attribute - it is not part of ser
object, just a standalone variable - though this is the default value. And initializing all attributes during object creations looks like a proper wayser = serial.Serial("COM4", 9600)It looks that you use default values for the rest of parameters anyway - see the docs
Test everything in a Python shell (iPython, Azure Notebook, etc.)
- Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
- Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
- You posted a claim that something you did not test works? Be prepared to eat your hat.