ap-- / voltcraft

Python module for voltcraft powersupplies
MIT License
10 stars 14 forks source link

Does not work with Python 3.x #2

Closed mbrennwa closed 4 years ago

mbrennwa commented 5 years ago

I can't connect to my PPS-11810 using Python 3.x. It does work with Python 2.7. Here's what happens with Python 3.6:

Python 3.6.7 (default, Oct 22 2018, 11:32:17) [GCC 8.2.0] on linux Type "help", "copyright", "credits" or "license" for more information.

import pps PSU = pps.PPS(port='/dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0', reset=False, prom=None) Traceback (most recent call last): File "", line 1, in File "/home/brennmat/voltcraft/pps.py", line 68, in init model = self.limits() File "/home/brennmat/voltcraft/pps.py", line 114, in limits s = self._query("GMAX") File "/home/brennmat/voltcraft/pps.py", line 97, in _query self._Serial.write("%s\r" % cmd) File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 532, in write d = to_bytes(data) File "/usr/lib/python3/dist-packages/serial/serialutil.py", line 63, in to_bytes raise TypeError('unicode strings are not supported, please encode to bytes: {!r}'.format(seq)) TypeError: unicode strings are not supported, please encode to bytes: 'GMAX\r'