You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As title explains, I have integrated the example code into a project, installed the library correctly, but everytime the project is run it errors out at the import line with the library recommending I run pip install rpi-gpio, although I already have it installed. Then, when ran I get told the requirement is already met.
(luma-env) pi@watch:~ $ python3 applications/test/main.py
Traceback (most recent call last):
File "/home/pi/luma-env/lib/python3.11/site-packages/rotary_encoder/_rotary_encoder.py", line 17, in <module>
import rotary_encoder_gpio_core as gpio # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pi/luma-env/lib/python3.11/site-packages/rotary_encoder_gpio_core/__init__.py", line 23, in <module>
from rotary_encoder_gpio_core._gpio import *
ModuleNotFoundError: No module named 'rotary_encoder_gpio_core._gpio'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/pi/applications/test/main.py", line 2, in <module>
import rotary_encoder
File "/home/pi/luma-env/lib/python3.11/site-packages/rotary_encoder/__init__.py", line 1, in <module>
from rotary_encoder._rotary_encoder import connect, CallbackHandling
File "/home/pi/luma-env/lib/python3.11/site-packages/rotary_encoder/_rotary_encoder.py", line 19, in <module>
raise MissingGPIOLibraryError(
rotary_encoder._rotary_encoder.MissingGPIOLibraryError: Could not import RPi.GPIO. If this code is running on a raspberry pi, make sure that the rpi-gpio library is installed. You may install it by running `pip install rpi-gpio`.
(luma-env) pi@watch:~ $
Here is the actual code of the project
from PIL import Image, ImageDraw, ImageFont
import rotary_encoder
import RPi.GPIO as GPIO
import sys
import os
import subprocess
import time
sys.path.insert(1, '/home/pi/')
import render
from functions import buttonHandler, mathClass, drawClass
import constants as c
image = Image.new("1", (128,64))
draw = ImageDraw.Draw(image)
fnt5x8 = ImageFont.truetype('fonts/5x8.ttf')
draw.rectangle((0,0, 128, 64), fill = "black")
drawClass.draw_text((128/2, 32), "Test app!", fnt5x8, draw, "center")
time.sleep(1)
counter = 0
def increment():
global counter
counter += 1
print(counter)
def decrement():
global counter
counter -= 1
print(counter)
def press():
print("PRESS")
def release():
print("RELEASE")
with rotary_encoder.connect(
clk_pin=20, # required
dt_pin=21, # required
on_clockwise_turn=increment, # optional
on_counter_clockwise_turn=decrement, # optional
):
draw.rectangle((0,0, 128, 64), fill = "black")
drawClass.draw_text((128/2, 32), counter, fnt5x8, draw, "center")
render.render_image(image)
the draw_text, render_image, and other function are apart of an OLED display system
The text was updated successfully, but these errors were encountered:
As title explains, I have integrated the example code into a project, installed the library correctly, but everytime the project is run it errors out at the import line with the library recommending I run
pip install rpi-gpio
, although I already have it installed. Then, when ran I get told the requirement is already met.Here is the actual code of the project
the draw_text, render_image, and other function are apart of an OLED display system
The text was updated successfully, but these errors were encountered: