I'm a dev new to raspberry pi helping someone out with their RPi project.

We have some basic code controlling an i2c bus via the smbus library and it runs fine on the RPi, but he'd like to get the code running on his Windows laptop just to see it running without errors there.

I'm not sure if this is possible, since I have an error on this line from inside the smbus2 module:

self.fd = os.open("/dev/i2c-{}".format(bus), os.O_RDWR)

The problem is that we're trying to run this on a Windows machine....there's no such things as /dev on Windows.

Am I trying to do something impossible here, essentially making Linux-specific code compile error-free on Windows? I can comment this line out and have it compile without errors, but this feels moderately pointless.

How do you normally develop for the pi on Windows?

  • 1
    Not Pi specific. The question is how do you develop non Windows apps on Windows,
    – joan
    Commented Jan 6, 2017 at 9:06
  • Yeah I was debating where to post it. But I'm basically asking if there's any established common workflow for Windows users creating Pi apps. For all I knew there was some under-the-radar IDE... Commented Jan 6, 2017 at 9:49
  • @Aerovistae No IDE will magically create a /dev filesystem on Windows, you need a Linux kernel for that. Commented Jan 18, 2017 at 17:52

1 Answer 1


But I'm not sure if this is possible.

Correct, it isn't. There's no Windows compatible version of the SMBus module.

  • Could you elaborate slightly? Why is that? The System Management Bus article on wikipedia says SMBus devices are supported by Windows; what am I missing? I thought it was a generic bus spec that had nothing to do with what OS the hardware was running. Commented Jan 6, 2017 at 22:17
  • You cannot access the SMbus on Windows from your code. There is no module for smbus for windows for your code. If you were using C, C++ or C# there would be a way, but that is not what you are using. Commented Jan 6, 2017 at 22:18
  • I mean, I can call C code from python via cffi; that's not an issue. Why would you say it's possible for C but impossible for python? That's a strange thing to say. Commented Jan 6, 2017 at 22:19
  • 5
    Why is that? -> Because no one has written one, most likely because until the recent advent of Windows IoT, there would be pretty much no one with any interest in writing I2C/SMBus code in python for Windows. Most computers have such a bus, but it is internal. So as John points out, presumably Windows has an API for this, but it would mostly be used by people writing proprietary drivers for whatever. They aren't going to be doing that in python.
    – goldilocks
    Commented Jan 6, 2017 at 22:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.