August 11, 2005

pySerial in Cygwin

Trying to talk to a serial device spitting out DEADBEEFn wasn’t working from Python (within Emacs) on Cygwin. Turns out the trick was setting the environment variable CYGWIN=reset_com. All of a sudden, I can do:

import serial
port = serial.Serial(0, baudrate=115200)
print port.readline()

without incident. (To clarify, from bash for testing this I just ran CYGWIN=reset_com emacs and then Emacs started Python, so Python saw this variable.)