Skip to content
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

Update to smbus2 #31

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Update to smbus2 #31

wants to merge 3 commits into from

Conversation

aaroncwhite
Copy link

Hey, thanks for the library! I've had to update to smbus2 so it plays nice with another library. Figure it might be useful. Not sure if this is still maintained, but just in case!

@m-rtijn
Copy link
Owner

m-rtijn commented Oct 21, 2020

Hey @aaroncwhite, thanks for the pull request!

Is there any particular reason to always want to use smbus2 over the standard python(3)-smbus package? If not, I rather keep this merge request open and refer to it in the README, to have the standard smbus package as the default and let people know that someone also made a fork using smbus2.

@ThinkalVB
Copy link

ThinkalVB commented Sep 21, 2021

What about this ?

import imp
try:
    imp.find_module('smbus')
    import smbus
except ImportError as e:
    import smbus2 as smbus

@m-rtijn
Copy link
Owner

m-rtijn commented Sep 25, 2021

@ThinkalVB this assumes that if the regular smbus is not available, then smbus2 will be available and/or you want to use smbus2. Which is an assumption that you probably should not make. I think it is better for users to explicitly choose which smbus version they use, either by using the master branch or using the fork by @aaroncwhite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants