Questions tagged [python-3]
Use this tag when referring to the Python 3 language. This can include discussions about specific features unique to the language or perhaps when referring to software that requires Python 3 in order to function. Note that general programming questions are often better suited to Stack Overflow; use this tag only where directly relevant to the Pi.
607 questions
0
votes
1
answer
26
views
python imports are different on pi zero and pi twozero?
Having tested my python programs using SSH on two Pis from a PC, I wanted to autostart them (they will be a pump manager in the cellar and an upstairs monitor with a call to my mobile if something ...
0
votes
0
answers
74
views
Could not load the Qt platform plugin
I'm using a Raspberry pi 5, I'm having issues running ultralytics and PyQt5 at the same time. The way I installed ultralytics and PyQt5 are different. First I used
sudo apt install python3-pyqt5
, ...
0
votes
1
answer
99
views
paho mqtt in python3: no module named typing_extensions
Pi Zero W Rev 1.1, running raspian buster.
I can't seem to import the paho MQTT client in python 3, with the error shown below.
Here are my installation steps:
sudo apt-get update
sudo apt-get upgrade
...
0
votes
0
answers
36
views
Reflashed my SD card for my Raspberry pi 5 the packages are still there
I reflashed my SD card for another project, I set it up some and packages that was previously installed back before I reflashed it is still in the /usr/lib like PyQt5 and PyQt5-sip it always show &...
0
votes
2
answers
110
views
How to deal with multiple events from IR remote control?
I am trying to capture events from an IR remote control in a python loop. I am using the evdev lib
Here is my code :
import evdev
def get_ir_device():
devices = [evdev.InputDevice(path) for path ...
0
votes
1
answer
85
views
Sysfs integration with python code - permissions issue
I’ve had a lot of issues regarding the sysfs interface recently, and unfortunately, I’ve got another unrelated one. I’m trying to integrate the sysfs gpio interface into my python3 code. This is ...
0
votes
0
answers
21
views
Why can't my IDE decide if my variable is Defined or not?
I'm building an adventure game as a fun way to teach myself python and I've run into an odd error. I've split my code out into multiple files for ease of management because its going to get pretty big ...
0
votes
0
answers
16
views
how do I update a variable with the contents of a textbox from inside a function?
I'm new to Python but not new to writing code. I'm attempting to write an adventure game as a way to stretch an assignment for a course. I can't use any extensions or libraries that don't come ...
0
votes
1
answer
37
views
Installing a package with pip instead of apt
Python 3.9.2
pip 20.3.4 from /usr/lib/python3/dist-packages/pip (python 3.9)
I installed a package (pycomm3) with pip because it isn't available with apt.
If I start the python program from the ...
0
votes
3
answers
74
views
Why is python 3.9 being used by my rpi bullseye OS for this envirophat pimoroni project?
i installed bullseye 32 bit on my rpi2 and installed the envirphat board on the pin header. I used to have the same envirphat board on a rpi0 that unfortunately got wet.
I installed the library as ...
0
votes
1
answer
52
views
Can't use tkinter, and may have multiple versions of python at once?
Unfortunately, I wasn't able to make this post with all the information I wanted to give. I was originally going to post it from the RPi 400 that I was having all these problems on, but apparently ...
0
votes
0
answers
42
views
Azure IOT hub python package error in Raspberry Pi
I am using Raspberry Pi 4 and working on a project which involve azure-iot-hub. I have installed it using pip3 install azure-iot-hub and I am importing it like
from azure.iot.hub import ...
0
votes
1
answer
895
views
How am I supposed to install Pillow (not PIL) on Raspberry Pi OS?
This is a new Pi 5 running Raspberry Pi OS and Python 3.11.
I have a dependency on Pillow. Definitely not PIL because PIL lacks certain features - specifically ImageTk: ImportError: cannot import ...
0
votes
0
answers
28
views
Adafruit_fingerprint from the adafruit circuit python library
This is my code with the error, I'm using a raspberry pi model 4B running off of thonny
import serial
import adafruit_fingerprint
#uart = serial.Serial("/dev/ttyUSB0", baudrate=57600, ...
0
votes
1
answer
237
views
Can I control IR filter of night vision camera
I'm using night vision camera (PIS-1138) with Raspberry Pi 4 and Picamera2 Python3 library successfully.
However, the camera seems to switch some sort of IR filter automatically on/off based on the ...
0
votes
0
answers
65
views
How to capture and geotag a image with Raspberry Pi 4 as a companion computer to a Pixhawk Orange Cube
All. I’m quite new to the DIY drones community and programing. I want to build a drone with a Pixhawk orange cube with Copter 4.5.1 and a computer companion Raspberry Pi 4 with its own camera module ...
0
votes
1
answer
345
views
Raspberry Pi 4: Python - RuntimeError: Error waiting for edge
I am trying to get the falling edge of a HB100 doppler radar with a Lm358 amplifier module.
The error is RuntimeError: Error waiting for edge
It was working great and stopped suddenly.
I have already ...
-2
votes
1
answer
72
views
RPi 5 Python Shhutdown command shutsdown then reboots
The issue I am facing is that my RPi 5 running bookworm is running a heavily modified version of the script found on https://learn.sparkfun.com/tutorials/raspberry-pi-safe-reboot-and-shutdown-button/...
0
votes
0
answers
104
views
Slow tkinter app loading and choppy mouse
I have a raspberry pi 5 running a python app that uses a customtkinter UI and TCP client running on a thread along with some serial port IO on another thread.
The app loads in around 15 seconds and ...
0
votes
0
answers
20
views
GPIO not performing program operations
I'm working on tensorflow lite project with custom models. I'm making a conveyor belt to detect and remove defective items which are trained by me. My camera detects object but when it comes to make ...
0
votes
0
answers
32
views
RPi 5 Code Does Not Work Without Root
I have a code. Because it is very long (2500 lines) I can not throw it here but here are the libraries:
import sys
import datetime
import locale
import serial
import time
import os
import cv2
import ...
2
votes
0
answers
955
views
Connecting a RFID-RC522 with Raspberry Pi 5
I bought a new Raspberry Pi 5 for a project that has RFID-tag reading and writing functions. I tried using some old python scripts(MFRC522-python) that uses RPi.GPIO to interact with the IO pins but ...
0
votes
0
answers
37
views
GNSS module do not working with raspberry pi, but working on pc
I have an error with my GNSS module. I use it with an usb-uart driver, and when I connect it to my computer, and read datas with u-center or in a python script I get continously updated position ...
0
votes
1
answer
119
views
I cannot install OpenCV on RaspberryPy
I cannot install OpenCV on RaspberryPi 4 Model B with Bookworm OS. I tried at least 4 different ways including pip and cmake. Each time I reach the step to install OpenCV, it ends in failure: cannot ...
0
votes
0
answers
84
views
How to run SPI1 and SPI0 at the same time?
I am currently attempting to send and receive data from SPI0 to SPI1 on a singular raspberry pi.
My Current code is as follows;
from multiprocessing import Process
import spidev
import time
import sys
...
0
votes
0
answers
337
views
Achieving high FPS on multiple still image captures
Trying to achieve a good 30 fps on Pi 3 Model B using the old 5MP camera module 1.3. Recently downloaded OS Bullseye, and using PiCamera2 on Python.
The goal is to achieve:
Good FPS ~30FPS for a 100~...
-1
votes
2
answers
1k
views
on bookworm cant use picamera2 with opencv-python
installed opencv--python on bookworm os
when using picamera2 i get this error:
QObject::moveToThread: Current thread (0x7f6802fd50) is not the object's thread (0x7f6822efb0).
Cannot move to target ...
0
votes
0
answers
34
views
how to start a tkinter GUI before the login window on raspberry pi4 b
I Have a raspberry pi 4B running using Debian GNU/Linux 12. I created an executable file as GUI. I want to start this GUI before the login window appear and when ever the user close it the login ...
0
votes
1
answer
70
views
PyQt5 Widget Background Color Incorrect on my Pi
I have searched high and low for this problem, but cannot find anything anywhere.
I have Python Version 3.8.10 and PyQt5 version 5.15.10 running in a Virtual Environment on my Py4 with 8Gb Memory ...
0
votes
1
answer
386
views
SPI sending and receiving data
I hope you can help.
I am currently using a raspberry pi 4b and want to be able to use the SPI capabilities. For my pi I have SPI0 and SPI1. The pins used are as follows;
SPI0_MOSI - pin 19 (BCM_10)
...
0
votes
0
answers
69
views
Why can’t I stream an mp4 from my RPI by opening it in the browser?
I’m new to self-hosting and am still learning what is and isn’t possible. I have a raspberrypi 4b and am running raspberry piOS Lite (bullseye). As an experiment, I uploaded an mp4 to my RPI and then ...
1
vote
1
answer
485
views
Adding a WiFi network with Python over bluetooth
I'm working on a project where a mobile app can find and pair with a headless raspberry pi running Pi OS (Debian Buster Port) over bluetooth, send it an ssid and password and it'll create and hop on ...
1
vote
1
answer
1k
views
Python PIP not working after upgrade
How do I fix this? I was trying to upgrade my Python to 3.10.2 which works fine. However, pip is throwing errors.
These are the steps I followed to upgrade:
#Downloaded new version and Extracted ...
0
votes
2
answers
130
views
Why does this GPIO button click run twice if I remove the print statement?
I run this script when the Raspberry Pi boots. When a key is pressed (GPIO 19) the interrupt function gets called.
If I remove the print("BUTTON PRESSED") statement on line 10, the interrupt ...
0
votes
1
answer
891
views
Raspbian: Visually Open Terminal Window and execute command after boot and login to desktop environment
Please god can someone help me. I've just spent the last 8 hours trying absolutely everything I can find online in every different way I can possibly think of and none of it works.
Chron jobs cant ...
0
votes
1
answer
22
views
Raspbian Show Service status via LED not finding substring in output
So im trying to make a Python script that constantly tests if a services is running and output the status via a red LED. I have a script:
import RPi.GPIO as GPIO
import time
import os
...
1
vote
1
answer
33
views
Outputting to SH1106 display with PIL only works from loaded files [closed]
I'm dealing with a maddening bug when trying to use an OLED module (sh1106 clone, interfaced over SPI) with a raspberry pi. I have stolen the following function from https://github.com/8TN/Raspberry-...
0
votes
1
answer
70
views
Convert from physical pins to I2C
I have a QR code scanner that uses wiegand protocol, have used this code for it, it worked fine for physical pins, but now I have another board onto the Pi, an extender board that uses i2c protocol, ...
2
votes
1
answer
924
views
Downloaded Raspberry Pi (32bit) showing up as (64bit) when verified with uname -m
I'm trying to use Raspberry Pi for a voice recognition project.
I have Raspberry Pi 4 model B.
I was having issue downloading PyTorch with the error of "Could not find a version that satisfies ...
0
votes
0
answers
72
views
How can I make some videos in the GUI that was designed using qt5 run in a loop?
I have some videos in a GUI that plays when certain conditions are met. The problem I have is that I am unable to make the videos start again after they end. Here is the code for the UI:
import os
...
0
votes
3
answers
2k
views
How can I run at boot or autostart an app with GUI?
I have a python script with a GUI that was designed with qt5, the script runs fine whenever I run it through the terminal or Thonny IDE. But no matter how much I tried, after trying many guides, ...
1
vote
0
answers
475
views
Use pip cache for docker builds
I want to install python packages within docker containers.
Since the build of some packages is time-consuming and sometimes fails, I want to use a cache that is reused.
I found the mount type cache ...
1
vote
1
answer
293
views
How to program remotely on horribly slow Pi-2
I have an old RPi 2 B which I've loaded the latest version of Raspberry Pi OS Lite onto. I'd like to use it to make an IoT device using an TFT LCD screen to show information like the weather and my ...
0
votes
0
answers
81
views
waiting for dbus address to appear error
I'm trying to run my Python executable on startup but I'm getting an error (waiting for dbus address to appear error) continuously it can't stop. Is there any way to stop I tried to update and upgrade ...
0
votes
0
answers
85
views
Trouble capturing images from a Raspberry Pi camera using Python
I am having trouble capturing images from a Raspberry Pi camera using Python. The following code works fine the first time, but fails to read data from the camera on subsequent attempts:
# shotFoto.py
...
1
vote
0
answers
163
views
PCA 9685 i2c communication issue
I would like to ask a question regarding the usage of secondary channel of i2c in rpi 4b.
I have enabled the secondary channel through adding "dtoverlay=i2c-gpio,bus=2,i2c_gpio_sda=22,...
1
vote
2
answers
2k
views
Updating Connector/Python for Python 3.11
Having moved to Python 3.11, I need to update Connector/Python - which requires the MariaDB Connector/C library.
This library is normally installed with
python -m pip install mariadb
But I'm getting ...
0
votes
0
answers
145
views
python script for 4x4 keypad, some buttons not working
I'm trying to use a python script to make a connection with my 4x4 keypad on Raspberry (RPi.GPIO). The code does not work correctly, because the first and second rows do not respond. I'm trying to use ...
0
votes
1
answer
360
views
Python requests is too slow with certain WI-FI connection
I'm working on a TTS app using AWS Polly in Raspberry PI 3 B+ and when I post a text using Python requests it take a long time receive the response, around 16-17 seconds. This happens only with a ...
1
vote
0
answers
67
views
Tkinter GUI not starting on boot with ROS
I'm trying to launch a tkinter GUI I made that is used to read GPIO pins as well as some ROS topics. I'm using Buster 10 and ROS Melodic with Python 3.7. I am using Clearpath's robot_upstart package ...