pySerial help please!

Diez B. Roggisch deets at
Tue Feb 10 23:41:09 CET 2009

bmaschino at schrieb:
> Hello all,
> I am very new to Python and I am using it because I needed an easy
> language to control a piece of equipment that connects to my computer
> via a serial cable. I am running Python 2.6 with pySerial 2.4 under
> Windows. I can get Python to create a serial port on COM1, but when I
> try to write to the device, nothing happens. Here is an example:
> import serial
> ser = serial.Serial(0)
> ser.write("otpm 2 16 0")
> ser.close()
> If I connect to the device in Hyperterminal the device will behave as
> expected when I give it the command 'otpm 2 16 0' but not in Python. I
> have confirmed Python is actually controlling the port because
> Hyperterminal will not open the port while Python has it open,
> although I have not been able to try a loopback connector as of yet.
> Any suggestions out there? Thanks in advance!

You need to give a newline, you press return on the terminal as well, 
don't you?


More information about the Python-list mailing list