OnionGpio for Python3
New user, and apologies if this question has been asked before (must have been).
Python3 has been out for years, and there's no reason anyone should use Python2... and yet... I've installed python3-light but struggle to find a Python3 version of the Onion basic package for controlling gpio ? Don't want a Python2 version, when I'm using Python3. Could someone help me please ? Got some technical knowledge but not a lot, and get annoyed when I go through Omega documentation and find numerous inconsistencies and non-working code...
Douglas Kryder last edited by
@Neil-Stelling if i remember correctly you need to uncomment some of the repos in the /etc/opkg/distfeeds.conf repo file. maybe one of the lede repos but you might search on it.
@Neil-Stelling is there any update on how to get GPIO to work for python3?
I have solved this problem.
See please for this repository https://github.com/OnionIoT/onion-gpio-sysfs/tree/master/python
You need the onionGpio.py file. But this file for Python2.x version. You must change all code line like "print xxxxxx" for "print(xxxxxx)". For example: "print 'GPIO%d path: %s'%(self.gpio, self.path)" change to "print ('GPIO%d path: %s'%(self.gpio, self.path))".
After that put this file to your project (or in Python PATH) and use it according to the instruction:
I know this is old. However, still needed as I cannot find a python3 module.
Thanks for this post which solved my problem.
I guess there is no resolution to this? It's now nearly 2 years since python2 went end-of-life so I find it a bit strange that Onion doesn't provide a python3 version of this module.
crispyoz last edited by
@phzdw Onion published the code to their python gpio module. Open source providers like Onion release their code so developers can collaborate on improvements and updates. This model allows companies such as Onion to push forward on new products rather than be tied down maintaining older code. This is the basic principle of the commercial open source model.