SyntaxFix
Write A Post
Hire A Developer
Questions
You have found the root cause. Alternately do like this:
ser.write(bytes(b'your_commands'))