Code Monkey home page Code Monkey logo

Comments (11)

bsimmo avatar bsimmo commented on August 16, 2024

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.

from mpu6050.

ah3243 avatar ah3243 commented on August 16, 2024

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:

  1. (install smbus2 through pip3) pip3 install smbus2
  2. (check that python3 can import smbus2)
  • python3
  • import smbus2
  • exit()
  1. (change the import statement in the mpu6050.py file, it's location is in the 'no nodule named smbus' error message. It's often in site-packages/mpu6050/mpu6050.py) Change:
    import smbus
    TO
    import smbus2 as smbus

hope this helps people..

from mpu6050.

m-rtijn avatar m-rtijn commented on August 16, 2024

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.

from mpu6050.

bsimmo avatar bsimmo commented on August 16, 2024

from mpu6050.

Bernix01 avatar Bernix01 commented on August 16, 2024

any update on this?

from mpu6050.

m-rtijn avatar m-rtijn commented on August 16, 2024

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.

from mpu6050.

bsimmo avatar bsimmo commented on August 16, 2024

from mpu6050.

m-rtijn avatar m-rtijn commented on August 16, 2024

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).

from mpu6050.

Bernix01 avatar Bernix01 commented on August 16, 2024

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.

from mpu6050.

m-rtijn avatar m-rtijn commented on August 16, 2024

Thanks for the heads up about the missing comma @Bernix01, I fixed it in commit 20351ad.

from mpu6050.

m-rtijn avatar m-rtijn commented on August 16, 2024

So I finally found some time to test it. Here are the results:

  • The regular branch seems to work fine in python3 when the 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.
  • The current 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.

from mpu6050.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.