Skip to content

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