Closed m-rtijn closed 6 years ago
There should be no need to, smbus works fine under Python3. There was a brief point a few years ago where it didn't.
The module is happily working on IDLE3 (from the same folder) on current Raspbian (Python3.5) I've not checked for any maths errors, it didn't like the commenting the top though.
If you have problems with smbus not being recognised, then you can use pip3 to install smbus2 then manually change the import in the smbus import statement in the mpu6050.py file to import smbus2 as smbus. So summary:
hope this helps people..
There should be no need to, smbus works fine under Python3. There was a brief point a few years ago where it didn't.
As far as I know, the python-smbus
package explicitly requires a python version <2.8; and thus doesn't support python3.
We're not talking the package, but the smbus import. Python3-smbus provides the Python3 version.
And I can test it and I have on recent Raspbian Stretch & Jessie. So though I'd save you the old faff of using smbus2 as a drop in fix.
On Thu, 26 Apr 2018, 15:35 Martijn, notifications@github.com wrote:
There should be no need to, smbus works fine under Python3. There was a brief point a few years ago where it didn't.
As far as I know, the python-smbus package explicitly requires a python version <2.8; and thus doesn't support python3.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Tijndagamer/mpu6050/issues/20#issuecomment-384663536, or mute the thread https://github.com/notifications/unsubscribe-auth/ALALt3AAcullQF9lG6eZd6NqYkGHP2M2ks5tsdsYgaJpZM4TW4t9 .
any update on this?
any update on this?
There's a python3-dev branch which should work with smbus2, but I haven't been able to test it yet.
It works with Python3. What's the problem you are seeing?
Perhaps update your smbus (via apt python3-smbus or pip3 if that has it.).
On Tue, 3 Jul 2018, 16:51 Guillermo Enrique Bernal Moreira, < notifications@github.com> wrote:
any update on this?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Tijndagamer/mpu6050/issues/20#issuecomment-402205210, or mute the thread https://github.com/notifications/unsubscribe-auth/ALALtwiLfy-RD2hJM4sWTFzMPFSwUC64ks5uC5MagaJpZM4TW4t9 .
It works with Python3. What's the problem you are seeing?
I haven't really had time to work on this project lately, but luckily the code generally seems to work so it's not really needed. However, last time I tried to use it I got some I/O errors, so I assume that there's something wrong with my sensor or with my Raspberry Pi (or the wires in between them).
Just a syntax error found on the python3-dev
setup.py
on line 25 a missing comma at the end. With that fix it works. I don't think this needs a PR but if needed I'll do it.
Thanks for the heads up about the missing comma @Bernix01, I fixed it in commit 20351ad045604919b318de7474b5e22bc36989c3.
So I finally found some time to test it. Here are the results:
python3-smbus
package is installed. I guess I had an outdated version of Raspbian the last time I worked on this project, because I don't remember ever having that package.python3-dev
branch works with the smbus2 package. I'll rename the branch to smbus2
for those who rather want to use smbus2.So, as a conclusion: python2 and python3 are now supported. I'll make a new release (1.1) with an updated README shortly.
Support python3 by switching to the smbus2 drop-in replacement for the python-smbus package.
The python3-dev branch should work with python3 and python2, but I can't test it at the moment.