-
Notifications
You must be signed in to change notification settings - Fork 490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support python 3.4 #5
Comments
Thanks, if you send a pull request I'll give it a test and merge it. Ideally the code will work on both 2.7 and 3.x, but if it can't easily be fixed I'd like to avoid having to write shims for compatibility. The Raspberry Pi standard distro (where this all started) is still on 3.2.3, so it might be different again to 3.4. If it gets too bad I'll have to fork it. |
Hi Ian, I'll try to test it on 3.2.3 as well, although I don't have a sensor tag, I'll try to keep the changes for py3 and for some refactoring I'm doing It might take some time, sorry. I just wanted to notify you I'm working on cheers, On 16 June 2014 18:08, Ian Harvey notifications@github.com wrote:
|
Hi guys, pi@raspberrypi ~ $ python3 work/bluepy/bluepy/bluepy/btle.py e0:c7:9d:5e:4a:9c Got: '# bluepy-helper.c built at 13:33:00 on Sep 4 2014\n' and it hung on there and bt dongle had no response ( LED light had no flash), but it run well on python 2.7 llke this , even had another error 📦 pi@raspberrypi ~ $ python work/bluepy/bluepy/bluepy/btle.py e0:c7:9d:5e:4a:9c Got: '# bluepy-helper.c built at 13:33:00 on Sep 4 2014\n' Got: 'rsp=$ntfy hnd=h2A d=bA55A\n' Got: "rsp=$stat state=$disc mtu=h0 sec='low\n" (process:3227): GLib-CRITICAL **: g_io_channel_read_chars: assertion 'channel->is_readable' failed any idea?! |
@BrianAtLonmed is the last trace for 2.7 or 3.4.1? The first problem seems to be something I encountered while adapting the code to 3.4, I need to remember what it was though 😄 . I'll try it out on a device of mine later today, hopefully I'll be able to reproduce it. The last issue seems, but I'm quite ignorant 😄 in that, that he received a notification which the helper 'passed up' to the script. Being it an async notification it got in the way of the normal state the automata was expecting. If it's the case I'll pass the ball to Ian for the last one. |
@kalfa first problem trace is for 3.4.1, last one is for 2.7. The issue for notification maybe I can resolve it , but it's for python2.7 and I prefer python3. |
It's looking like the second problem could be that the device is sending us a notification, which we're not expecting so report it as an error. I'm out of the country at the moment so I can't do much now, but I can suggest a patch to just drop notifications when I get back. Thanks, Sent from my iPod
|
Hi Ian bluepy-helper.c built at 16:15:35 on Sep 4 2014The second time it hungs Im running on a raspberry pi and the distro is arch linux. |
@Jord33 and @BrianAtLonmed , I created two issues, which probably have a reason in common: #10 and #11 @IanHarvey would you mind to tag those issues "python3.4' or similar and assigning them to me, please? |
Kalfa... thanks i found, the the bug. |
So I've done a bit of work on Python3.4 issues, it now works for me with a sensortag on Python 3.4.1 (built from python.org's source tarball, on raspbian on a Pi). This was mostly the flush() fix, and a couple of str-vs-bytes issues. I've also put in a trial fix for @BrianAtLonmed 's 'ntfy' exception problem, although I've not tested it's effective. @kalfa - I've put you as a collaborator on the project, so if you want to make extra 3.4-related fixes, be my guest. Have a good evening, all... |
thanks for the fixes and the collaborators bits, @IanHarvey , I would have had time to work on it just tomorrow evening. |
@IanHarvey I've tested it and it works well , thanks |
I'm closing this for now, as it's now basically working. Any bugs in the 3.4-specific code should probably be raised as separate issues. |
I amended btle.py with some support for py3.4, I'll do a pull request at some point in the future.
Feel free to see my fork's branch "py3". I had to reformat many things, as they broke on python 3.4.
I took the chance to have them formatted as much I could with pylint, pep8 and pep257, as I'm planning to use the code later.
Back compatible with 2.7 in theory, I tried it out and it works, but there are no unit tests so it's hard to say.
The text was updated successfully, but these errors were encountered: