The pySerial module is a Python add-on that provides access to the serial port.


  • Having pywin32 is a requirement for using pySerial. Follow these instructions to install pywin32 with Vizard.
  • Go to the pySerial download page and download the latest version of the pySerial installer. The installer should work for all versions of Python.
  • Run the installer. It should automatically detect Vizard's Python installation. If you have multiple Python installations on your computer, make sure you select the Vizard Python installation.


Open port 0 at "9600,8,N,1", no timeout

import serial

ser = serial.Serial(0) # open first serial port

print ser.portstr       # check which port was really used

ser.write("hello") # write a string

ser.close() # close port

Open named port at "19200,8,N,1", 1s timeout

ser = serial.Serial('/dev/ttyS1', 19200, timeout=1)

x = # read one byte

s = # read up to ten bytes (timeout)

line = ser.readline() # read a 'n' terminated line


For more examples and documentation visit the pySerial page at