Python3 modules for GPIO and Serial Port.
I'm not able to find packages for python3 for using GPIO or SerialPort... are they only available for python2? If so, will in near future this packages available for python3? what about a one-wire package?
if you use SSH and do opkg you will see the available commands.
then do opkg list (it displays all available, quite long list)
or simpler: opkg list | grep pyth (to limit and show only the part of the list that has 'pyth' in the text.
You will then see python and also python3 stuff.
I think that you have to use opkg install python3-light or python3 (i you want all)
then you need
then opkg install pyOnionGpio
I think it should be ok then.
Personnally i used also pyserial BUT:
I wanted only python3-light to limit the space used.
Then i used opkg install python-pyserial
BUT it installs python-base then python-light (based on python 2.7) then python-pyserial
but when my python script does import 'serial', it fails.
So finally i removed python3 and let python 2.7
I don't know how to use python3 and make it point to serial although pyserial is said to work with python3.
Yes, i already knew how to list python specific packages.. the thing is that (at least when i tested) pyOnionGpio is only available for python2. When a try to import in python 3 it fails.. same with pyserial.
@Pablo-Fonovich You can use pip to install pyserial:
opkg install python3-light python3-pip pip3 install pyserial
@Lazar-Demin But what about pyOnionGpio? Also, python3-pip installs all the python3 packages, which seems excessive.
Seems like this works for me: https://translate.googleusercontent.com/translate_c?depth=1&hl=en&prev=search&rurl=translate.google.com&sl=ru&sp=nmt4&u=https://community.onion.io/topic/2590/oniongpio-for-python3/4&xid=17259,15700023,15700186,15700190,15700256,15700259,15700262,15700265&usg=ALkJrhgV-JNL_SqSvvD1G2qQbTm6Cjlzzg
Correction, the above does not work for me
pyOnionGpio was written as a quick and dirty wrapper for the sysfs gpio interface. I wouldn't recommend using it for anything other than a hello world.
There are other (likely better) sysfs gpio libraries available for Python3:
Let us know how it goes!
This has worked for me, thanks Lazar! I'm having some weird SPI no_cs issue now that I'm trying to work through...anytime that command is included in the Python project, sleep gets an argument error. If I comment that line out then the project runs without error. I'll report back if I get it resolved.