Not work for python3 with too many problems... #61
Comments
I also had the same problem on Python 3.6, so I did some minor fix to "FT232h.py". Although I only tested GPIO and I2c features, it is working fine so far. You can replace FT232h.py in your Adafruit_GPIO folder by this one https://github.com/atelier-ritz/Python3.6-32bit--FT232H-libftdi1.4. If you are interested in what changes are made, you can google "Python3 bytes bytearray unicode" and it will give you a rough idea. |
Short answer: The problem seem be caused by libftdi version 1.2 and Python 3.x. Since a lot of the Adafruit_GPIO users are bitten by this bug it's worthwhile to take Long version: Under Kubuntu 16.04-64 I had the same problem. I started with the current version of the Adafruit_GPIO library (commit 22a1ff4 version), Python 3 (version 3.5.2) and with libftdi1-2 (1.2-5build1) which is available from the official Ubuntu ressources.
In the inital post dukelec had the same error message so the conclusion lies at hand that Therefore I swapped the original FT232H.py with atelier-ritz's version (thanks for providing the patches!).
to
After some minor changes elsewhere the code ran fine under Python 3 - and produced exactly the same
So I rolled back the changes I made myself and returned to the new, original FT232H.py and started experimenting with various versions of libftdi. As suggested here[3] I installed libftdi from source (after uninstalling the official Ubuntu version). And, beginning with libftdi version 1.3 the time out error was gone. According to the change log this was probably due to a swig bug in libftdi.
So that's it... GHPS P.S. @atelier-ritz Please submit an official pull request - even though Adafruit is years behind 1: http://developer.intra2net.com/git/?p=libftdi;a=commitdiff;h=f64b66d604c5d78886d47034fb2db2176fc24a09 |
Thank you GHPS for your detailed report. |
I submitted a bug to Ubuntu packaging to provide libftdi 1.2 for python-ftdi and libftdi 1.4 for python3-ftdi. https://bugs.launchpad.net/ubuntu/+source/libftdi1/+bug/1815049 |
Is anybody working on this issue? We have integrated the FT232H board on some of our electronics but the laptop controlling the thing crashed. We figured we would try to get it running on Python 3 64-bit, since 2 is so old (we're not even able to find PyQt5 Wheels for it anymore). Turns out this is much more difficult than expected. Switching to the updated libftdi seems to work on Python 3.6 by using https://sourceforge.net/projects/picusb/files/libftdi1-1.4git_devkit_x86_x64_14June2018.zip/download However, Adafruit_GPIO has a few issues:
We haven't tried the atelier-ritz update yet (https://github.com/atelier-ritz/Python3.6-32bit--FT232H-libftdi1.4) or the "make FT232H compatible with Python 3" branch (#106). Is there anybody who has experience with these solutions and/or whether they will be merged in the official release soon? Barring finding PyQt5 for Python 2 we'd have to run the FT232H code in Python 2 and the rest in Python 3 or something. It would be nice to be able to just use the FT232H with Python 3 64-bit... |
Hi, I don't know if Adafruit is currently working on this issue, but I had
the same issues as you do when I started using FT232H board on Python 3 on
a Windows machine. Basically I dealt with the string/byte errors (as you
mentioned, using .encode()) in FT232H.py and did some workaround on libftdi
version... Finally I could get FT232H to work with Python3 and PyQt5. (It
took me about a week though) So it's definitely possible, but I agree with
you that Adafruit should post a version that works with Python 3.6+.
I have FT232H working on Windows but I'm not sure about Ubuntu cuz I didn't
try it.
atelier-ritz
…On Fri, May 24, 2019 at 8:11 AM shapecoder ***@***.***> wrote:
Is anybody working on this issue? We have integrated the FT232H board on
some of our electronics but the laptop controlling the thing crashed. We
figured we would try to get it running on Python 3 64-bit, since 2 is so
old (we're not even able to find PyQt5 Wheels for it anymore). Turns out
this is much more difficult than expected.
Switching to the updated libftdi seems to work on Python 3.6 by using
https://sourceforge.net/projects/picusb/files/libftdi1-1.4git_devkit_x86_x64_14June2018.zip/download
However, Adafruit_GPIO has a few issues:
- Tabs/spaces errors, relatively easy to fix
- string errors where bytes are expected, also fixable with .encode()
- timeout errors as described by people in this issue
We haven't tried the atelier-ritz update yet (
https://github.com/atelier-ritz/Python3.6-32bit--FT232H-libftdi1.4) or
the "make FT232H compatible with Python 3" branch (#106
<#106>). Is there
anybody who has experience with these solutions and/or whether they will be
merged in the official release soon?
Barring finding PyQt5 for Python 2 we'd have to run the FT232H code in
Python 2 and the rest in Python 3 or something. It would be nice to be able
to just use the FT232H with Python 3 64-bit...
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#61?email_source=notifications&email_token=AF7M5Q7FLN2XEYJRYFECX7DPW7LP3A5CNFSM4DGESCEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWFDSGA#issuecomment-495597848>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AF7M5Q6KLHSZHGBYWJ5QDODPW7LP3ANCNFSM4DGESCEA>
.
|
this repo def need some attention. if anyone can help by submitting a PR to make it py3 compatible and also testing, it would be deeply appreciated! |
I just tested the existing PR (#106) and it seems to work :) Installed Python 3.6.8 64-bit and used the libftdi1-1.4 driver I mentioned earlier (installed everything according to the manual, just different versions). Pulled the Adafruit_GPIO master and replaced the FT232H.py from the PR before installing and I'm able to ping my ADS1115 ADC and read out a channel. Really happy that it works, saved my weekend :P |
please comment on that saying what you ended up testing - we haven't merged it cause there's not a lot of test coverage (yet) |
@ladyada I would recommend merging #106 The author explained the changes really well in the conversation I had with him, and I did reading on python 3 documentation to verify. They are really small changes really, but necessary for python 3, and equivalent for python 2 I haven't tried it as I don't have the time/need/space for python 3 right now, but I can see that what he did is necessary for it, and if it's not fully compatible now, its a good start at least |
done, we'll see who complains if it doesnt work - will revert if necessary! |
hiya thank you for the issue. we're going to be deprecating this library in favor of our python3 Blinka library which has support for almost 200 different drivers, and a wide variety of linux computers as well as ft232h |
First:
after comment out this line:
self._mpsse_sync()
:after remove all
chr
in functionmpsse_gpio
:Adafruit_Python_GPIO version:
libftdi vertion:
libftdi1-1.2
python version:
Python 3.6.0 Python 3.5.2
no problem with
Python 2.7.12
The text was updated successfully, but these errors were encountered: