#128 Request for reopen: pyserial does not work on OS X 10.6.8


This is a request to reopen bug report ID: 3395703.

The claim was that pyserial installs under python 3 properly now. It's true that it *installs*, but not that installs *correctly*. For example, running some test code of ours (which works robustly under python 2.7), we get:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "./create.py", line 595, in __init__
self._start() # go to passive mode - want to do this
File "./create.py", line 802, in _start
self._write( START )
File "./create.py", line 620, in _write
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/serial/serialposix.py", line 475, in write
n = os.write(self.fd, d)
TypeError: 'str' does not support the buffer interface

It appears that there are still errors in pyserial's implementation with regard to OS X under python 3. I can provide code to test this if it would be helpful (contact me at sean.luke@gmail.com).


  • aeroaks

    aeroaks - 2013-10-12

    have you seen this link???

  • Chris Liechti

    Chris Liechti - 2013-10-12
    • status: open --> pending-works-for-me
    • assigned_to: Chris Liechti
    • Group: --> v2.6
  • Chris Liechti

    Chris Liechti - 2013-10-12

    As already hinted by the other comment, you need to pass bytes to pySerial not "str" (which is unicode in Python 3). Unlike Python 2.x it makes a difference in Python 3 if you're working with bytes (binary data) or strings (unicode text). You can convert between the two types with the bytes() function, the .encode()/.decode() methods of strings/bytes or you can wrap the serial port using a io.TextIOWrapper.

    pySerial considers serial ports to be a binary interface. As many usages involve truly binary protocols and it is easy to get from binary to text, while the other direction is not possible, in a generic way (e.g. if the encoding was "ascii", no character >128 could be recovered).

  • Chris Liechti

    Chris Liechti - 2013-10-17
    • status: pending-works-for-me --> closed-works-for-me

Log in to post a comment.