Tiny Core Base > Raspberry Pi
Python 3 cant find RPi.GPIO
johnwmcc:
After a lot of hassle, i've installed piCore 9.03 on an RPi Zero W, got it to reboot and run WiFi, SSH, a desktop, python3.6, and x11vnc.
I've got onboot.lst to run these of modules on startup.
I've hit a number of roadblocks, which use of Google has mostly (eventually) resolved. Unfortunately, most of the instructions I found for installing piCore on Pi Zero W are incomplete or even inconsistent, but eventually I figured things out and have got most of what I want to do to work.
But I'm stuck, and can't find an answer using Google. I can load python3.6 (using sudo - naughty, I know, but it won't run the IDLE IDE unless I do that). At the python prompt, I get the IDE to run using
>>> import idlelib.idle
I've also run in a terminal the commandtce-load -iw python-RPi.GPIO to install the GPIO module, and put that in onboot.lst too. And if I run it a second time, it tells me it's already loaded.
But python can't find it. A python program using import RPi.GPIO fails, and creates an error.
Using Midnight Commander to search the mounted filesystem can find no file corresponding to a file search pattern of *RPi.GPIO* except .tcz files in tce/optional, anywhere.
What can I do to get GPIO to work in python3?
Is my problem to do with running python with sudo? If so, how do I get IDLE to work without that?
Any help would be welcome. At the moment I'm completely stuck.
Rich:
Hi johnwmcc
According to:
http://tinycorelinux.net/9.x/armv6/tcz/python-RPi.GPIO.tcz.list
that extension contains:
--- Code: ---usr/local/lib/python2.7/site-packages/RPi.GPIO-0.6.2-py2.7.egg-info
usr/local/lib/python2.7/site-packages/RPi/_GPIO.so
usr/local/lib/python2.7/site-packages/RPi/GPIO/__init__.py
usr/local/lib/python2.7/site-packages/RPi/__init__.py
--- End code ---
Is it possible python3 doesn't know to look under /usr/local/lib/python2.7/ ?
johnwmcc:
I can see that the python2.7 files are there, and also that python 3.6 isn't finding them.
But how do I fix that?
Rich:
Hi johnwmcc
See if Google returns anything useful for PYTHONPATH.
Juanito:
I believe that you will have to recompile gpio against python3.6
Navigation
[0] Message Index
[#] Next page
Go to full version