pyserial ser.write('string') TypeError in OS X

Rodrigo rodrigososa at
Tue Oct 20 23:02:03 CEST 2009

Maybe this is not a bug at all, but i have installed python2.5. 3.01
and 3.1.1. In python 2.5 ser. write('this is a string') works just
On the other hand, with 3.01 and 3.1.1 (pyserial 2.5 rc1) when i do a
ser.write('this is a string') i get the following error"

>>> import serial
>>> ser = serial.Serial('/dev/tty.usbserial')
>>> ser.write('this is a string')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.1/lib/
python3.1/site-packages/serial/", line 466, in write
    raise TypeError('expected %s or bytearray, got %s' % (bytes, type
TypeError: expected <class 'bytes'> or bytearray, got <class 'str'>

I honestly dont get what im doing wrong here

any feedback much appreciated


More information about the Python-list mailing list