Discussion:
Problems with python example
Xiaofan Chen
2017-01-08 12:57:40 UTC
Permalink
MyMacMini:python xiaofanc$ python complete.py
version: 1.3
devices: 1
#0: manufacturer="FTDI" description="FT232R USB UART" serial="A8007Ub5"
turning everything on
Traceback (most recent call last):
File "complete.py", line 63, in <module>
ftdi.write_data(ftdic, chr(0xff), 1)
TypeError: write_data() takes exactly 2 arguments (3 given)

After removing the last argument, i.e., deleting " , 1", it seems to
work fine. Maybe there is a change between libftdi1 version 1.2 and 1.3.

MyMacMini:python xiaofanc$ python complete.py
version: 1.3
devices: 1
#0: manufacturer="FTDI" description="FT232R USB UART" serial="A8007Ub5"
turning everything on
turning everything off
enabling bit #0 (0x01)
enabling bit #1 (0x02)
enabling bit #2 (0x04)
enabling bit #3 (0x08)
enabling bit #4 (0x10)
enabling bit #5 (0x20)
enabling bit #6 (0x40)
enabling bit #7 (0x80)
pins: 0xff
chip id: 30b7ef1
eeprom @ 1: 0x0403
eeprom:
00 40 03 04 01 60 00 00
a0 2d 08 00 00 00 98 0a
a2 20 c2 12 23 10 05 00
0a 03 46 00 54 00 44 00
49 00 20 03 46 00 54 00
32 00 33 00 32 00 52 00
20 00 55 00 53 00 42 00
20 00 55 00 41 00 52 00
54 00 12 03 41 00 38 00
30 00 30 00 37 00 55 00
62 00 35 00 c9 bf 1c 80
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 0f 23

device closed
--
Xiaofan

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+***@developer.intra2net.com
Xiaofan Chen
2018-06-09 12:40:02 UTC
Permalink
Post by Xiaofan Chen
MyMacMini:python xiaofanc$ python complete.py
version: 1.3
devices: 1
#0: manufacturer="FTDI" description="FT232R USB UART" serial="A8007Ub5"
turning everything on
File "complete.py", line 63, in <module>
ftdi.write_data(ftdic, chr(0xff), 1)
TypeError: write_data() takes exactly 2 arguments (3 given)
After removing the last argument, i.e., deleting " , 1", it seems to
work fine. Maybe there is a change between libftdi1 version 1.2 and 1.3.
The issue is still in latest git.

(playusb) c:\work\libftdi\libftdi\python\examples>python
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Post by Xiaofan Chen
exit()
1) simple.py works fine
(playusb) c:\work\libftdi\libftdi\python\examples>python simple.py
[FTDI version] major: 1, minor: 4, micro: 0, version_str: 1.4,
snapshot_str: v1.4-12-g91dbb65
ftdi.usb_open(): 0
ftdi.set_baudrate(): 0

2) cbus.py throws invalid syntax error
(playusb) c:\work\libftdi\libftdi\python\examples>python cbus.py
File "cbus.py", line 93
print 'manufacturer="%s" description="%s" serial="%s"' %
(manufacturer, description, serial)
^
SyntaxError: invalid syntax

3) complete.py has the same problem as before.
(playusb) c:\work\libftdi\libftdi\python\examples>python complete.py
version: 1.4

devices: 1
#0: manufacturer="FTDI" description="FT232R USB UART" serial="A8007Ub5"

turning everything on
Traceback (most recent call last):
File "complete.py", line 63, in <module>
ftdi.write_data(ftdic, chr(0xff), 1)
TypeError: write_data() takes 2 positional arguments but 3 were given

4) After removing the last argument, i.e., deleting " , 1", it seems to
work a bit further but complete.py still does not work.

(playusb) c:\work\libftdi\libftdi\python\examples>python complete.py
version: 1.4

devices: 1
#0: manufacturer="FTDI" description="FT232R USB UART" serial="A8007Ub5"

turning everything on
TypeError: expected bytes, str found

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "complete.py", line 63, in <module>
ftdi.write_data(ftdic, chr(0xff))
File "C:\work\pyenv64\playusb\lib\site-packages\ftdi1.py", line 342,
in write_data
return _ftdi1.write_data(ftdi, buf)
SystemError: <built-in function write_data> returned a result with an error set
--
Xiaofan

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+***@developer.intra2net.com
Loading...