No oled library for python3?
-
I have found that you can utilize the Oled with python 2.7 but not with 3. Has anyone figured out how to get it to work? I also found this page in search of a library for 3. As well as their current documentation on it.
https://onion.io/tag/onion-omega-oled-python-module/
https://docs.onion.io/omega2-docs/oled-expansion-python-module.html#oled-expansion-python-module
-
@Tyler-Mattioli looks like you'd have to convert Python 2 OLED code (the whole framework, really) to python 3, compile it from that new source. Otherwise, you're stuck doing the things listed here, though they may not work on the embedded systems due to the libraries needed probably not being supported.
-
@Tyler-Mattioli @Theodore-Borromeo all of the OLED, PWM, and Relay source code can be found here: https://github.com/OnionIoT/i2c-exp-driver
The Python2.7 implementation can be found at: https://github.com/OnionIoT/i2c-exp-driver/tree/master/src/python
We haven't had the time to port everything for Python3. If you have the time and initiative to implement libraries please submit a pull request!
-
@Lazar-Demin Looking at the code, I don't know if there'd be any changes to the c code underlying the python layers, but I'd like to be sure you all have a docker container that allows for easy experimentation, compile and testing. Is there a best practice for compiling what you do have now? I'd want to be sure I can even build the current stuff before I'd ever agree to attempt a Python 3 translation. ( I don't even use python 3. . ., but I guess there's always a first time)
-
@Theodore-Borromeo We don't have such a Docker container at the moment. We will evaluate this and then get back to all you guys with a roadmap when we're largely done with the crowdfunding campaigns!
For the short-term, you can use the i2c-exp-driver package Makefile from our package repo: https://github.com/OnionIoT/OpenWRT-Packages
in a regular Lede buildroot. It should compile without any issues.
-
@Lazar-Demin If that's what you have, then I already have an omega2 plus lede buildroot within a docker container. . .
-
Looking for where or how I'm supposed to get the file at:
#include <Python.h>I assume this is a file provided for creating Python interfaces in C, no? If so, what packages in LEDE were used to satisfy the programming dependencies for python2? I would need to replicate that for python3, and then install the necessary python3 dev packages too, right?
I'm looking in:
https://github.com/OnionIoT/i2c-exp-driver/tree/master/includeand don't see the necessary includes I would need to do a compile switching to python3. . .
I am also presuming that:
from OmegaExpansion import pwmExp
is built from:
https://github.com/OnionIoT/i2c-exp-driver/blob/master/makefileI can't seem to find how or where you all built that python library. Is there something I'm not seeing?
-
Ugh. Python.h is the C API that should be part of the dev packages for python2. It won't be in the source tree (at least it shouldn't!) for i2c-exp-driver.
I also figured out that the openwrt packages repo dictates that the OmegaExpansion module in
from OmegaExpansion import pwmExpis just a directory in the python install path. . . It now makes sense as to why I couldn't figure out where in the makefile you were building that module (turns out you werent', it's just the directory!)
With all that said, it seems that a good first tack would be to take the python version definition in the makefile in packages tree, and propagate that down into the python library linkages while building the python c wrapper libs. Right now, we are statically linking to python2 in the pwmExp libs, which will definitely NOT work with python3, even if Python.h defines an API which should still be usable by python 3 or python 2 without much issues. . .
-
I would really appreciate a python3 version of the library as I'm trying to build a home automation solution around python3 at the moment.