Questions tagged [python]

Python is a general-purpose, dynamically typed, object-oriented high-level programming language. Interpreters for versions 3.x and 2.x come installed on the Raspberry Pi's most popular operating system distributions.

Filter by
Sorted by
Tagged with
2 votes
0 answers
201 views

Error loading shared library on python

I'm trying to get a piece of code running on a raspberry pi model 4b that I believe was previously running of a server running Debian10 (although now I am not so sure). The code errors at this line ...
user151456's user avatar
2 votes
2 answers
277 views

HC-SR04 sensor's ECHO pin stuck on HIGH

I have a raspberry pi 4 and a HC-SR04 ultrasonic distance sensor. I want to use it in a raspberry-pi based robot. The other features look fine, the robot can move, et cetera. But my code for the ...
allen546's user avatar
1 vote
1 answer
22 views

Scheduled screen dimming with mouse interrupt not working

I have the official raspberry pi 7" touch screen and I'm struggling to get my python script to reset the screen brightness when I touch the screen. I've setup a service that calls my ...
bameyrick's user avatar
0 votes
1 answer
183 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 ...
Shyam3089's user avatar
  • 111
0 votes
0 answers
23 views

GPIO Switch Issue

I am writing a PICO application that sends a urequest. So far, I have everything done to what I feel is right until I execute python. In my code, I have a while True statement starting my loop, so its ...
v3rb's user avatar
  • 1
1 vote
1 answer
154 views

Playing audio with Python scrpitpt run from Cron

I have a USB sound card connecting mic & speakers to a Raspberry Pi Zero W + The following script plays audio fine when run from the terminal. However, when run from cron, nothing can be heard. ...
PangolinPaws's user avatar
1 vote
0 answers
37 views

Issue a custom command using pitunnel

I have a Pi 4 at home, which is wired in to some servos which, via a python script, make hands turn on a clock face, making them point to 'home', 'work', 'school' etc - I think you can see what this ...
dartacus's user avatar
  • 111
1 vote
1 answer
2k views

Can't install Opencv on raspberry pi 4

I'm using the raspberry pi 4 (pip version: pip 22.3.1, python version: 3.9.2) on visual studio code and whenever I enter the command pip install opencv-python in the terminal, after 40 mins I get the ...
Ali Moradi's user avatar
2 votes
0 answers
220 views

Problem with the import bluetooth!

I have tried a lot of this lines programs but the terminal it keep's complaint. Error message: Import Error:No module named bluetooth._bluetooth I have install some lib but again the problem it shows. ...
Lilfio's user avatar
  • 21
1 vote
2 answers
610 views

Run python script with GUI on boot

I have set up a python script, that uses tkinter to launch a window and display some data. My goal now is to let the Pi run this script after boot. For this, I tried many ways I found on the internet. ...
VRK's user avatar
  • 21
1 vote
0 answers
130 views

Playing random Videos with omxplayer (PIR) [closed]

I am trying to do the following: I connected a PIR-Sensor to my raspberry pi to detect motion. If there is motion detected my pi should play random videos from the folder "videos" (about 20-...
marc's user avatar
  • 11
1 vote
0 answers
99 views

Command Raspberry Pi 4 GPIO via bash Windows 10

from RPi import GPIO global ON global OFF OFF = GPIO.LOW ON = GPIO.HIGH GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(21, GPIO.OUT) x = open(testo.txt") if x.read() == "true"...
Andrea Ruffo's user avatar
0 votes
2 answers
525 views

How to make systemd wait for my network to come online?

I've created the following systemd unit: [Unit] Description=MagicMirrorConfig After=network-online.target Wants=network-online.target [Service] ExecStart=sh /home/pi/magicmirror-config/launcher.sh ...
pinoob's user avatar
  • 101
0 votes
0 answers
71 views

If I start a script using audostart where do my logs go?

I've added an entry to my /etc/xdg/lxsession/LXDE-pi/autostart file as follows: @lxpanel --profile LXDE-pi @pcmanfm --desktop --profile LXDE-pi @xscreensaver -no-splash @/usr/bin/python /home/pi/...
pinoob's user avatar
  • 101
0 votes
0 answers
43 views

No response from urllib3 package as of December 2022

for months I have used my Raspberry Pi (Raspbian version 10 [Buster]) to query different APIs using different python packages (such as tgtg or spotipy. Everything worked perfectly until the start of ...
nickhir's user avatar
  • 63
0 votes
0 answers
62 views

Not synchronized audio and video recorded with python

i bought an USB microphone and a Camera module for the raspberry pi4. I managed to record Audio and Video but when i merge them with ffmpeg the are not synchronized, i'm trying to solve this for 2 ...
LAC's user avatar
  • 1
0 votes
0 answers
10 views

plolty DASH on Raspberry pi 3+B

I have a question. I have written a python script in a raspberry pi3 to get data from a sensor and plot it with dash in Browser once per second. It works very well with pretty good accuracy when I do ...
lesandromarteniz's user avatar
0 votes
0 answers
66 views

pyenv deletes python after installing

I try installing python with pyenv install 3.11.0 (though this happens no matter the version) on my Raspberry Pi. When the install is running, there's a 3.11.0 directory in ~/.pyenv/versions, pyenv ...
Tuor's user avatar
  • 101
1 vote
2 answers
193 views

Python script will not write out file when scheduled (cron or bash.rc)

I have a python script to record a .mp4 file with picamera2 which executes and save correctly when run through the editor (thonny) and through the terminal. However, when I schedule it through crontab ...
roconnor's user avatar
1 vote
0 answers
35 views

Why would an app started by systemd on boot perform differently [closed]

I have a python application that I'm trying to start using systemd. I have my unit file set up and systemd configured to start the app. When I sudo systemctl start my_app.service it starts and ...
Riggs's user avatar
  • 11
0 votes
0 answers
70 views

Why does my script fails on autostart but works fine when executed manually?

I am using a python script to send a json to an arduino to controll led intensity by pwm. The script parses a csv file to find the current led instensity to set up. The script looks like that: #!/usr/...
M_K's user avatar
  • 1
2 votes
1 answer
4k views

Python 3.11.0 Import sqlite not found

I've tried python -m pip install -U sqlite it returns No matching distribution found for sqlite I'm using python 3.11.0
Universe Explained's user avatar
1 vote
0 answers
217 views

Rpi4b -> Use Serial HC-12 SI4463 Transceiver to send to Generic RF outlets and 433 switches

Raspberry Pi4B Hi, I am using a 433 MHZ TX/RX kit connected via GPIO pin 27 for receive and GPIO pin 22 to send signals to my RF power outlets and receive signals from my 433mhz Wireless Magnetic Door ...
Viktor Carlson's user avatar
3 votes
2 answers
3k views

my raspberry pi pico oled display code is returning 'OSError: [Errno 5] EIO'

I've been trying to use an ssd1306 oled display with a raspberry pi pico but every time I run the code it returns an error. I don't know what the error means and can't really find anything online for ...
odog's user avatar
  • 31
1 vote
1 answer
113 views

My Application (based on python tkinter) is not running at Boot time (autostart) in Raspberry Pi Os?

I have made executable file of python tkinter application. It runs well when clicked. But I want to run it at Boot time (AutoStart) in Raspberry Pi Os. I have tried many methods but they didn't work. ...
Sukrit Machine Tools's user avatar
1 vote
1 answer
303 views

Python function following physical input not working with kivy

I'm trying to create this functionality that when a physical button is pressed a function is called that if true opens a popup on the main Kivy screen. The idea was to have the display showing the ...
user20546541's user avatar
0 votes
1 answer
2k views

TypeError: unsupported format string passed to NoneType.__format__

I have 3 DHT22 sensor connected to my Raspberry Pi. Two connected to 5V, 1 to 3.3V. Initially this worked fine. Now, one of the scripts running one of the sensors gives me this error: RuntimeError, ...
Prmake's user avatar
  • 23
1 vote
1 answer
89 views

gpiozero's wait for release not working as it should

I'm trying to build a program that has 2 inputs connected to 2 limit switches and each of these needs to be first opened and then closed before the function respective to each button begins. As a ...
user20546541's user avatar
0 votes
0 answers
33 views

LoRa HAT communication module don't send anything

I'm working now an long range communication system, and I need help. I can't use GSM, WIFI, etc. I test one LoRa Raspberry pi shield, and I bought this: link, and I have followed this tutorial. Ofc I ...
Domkrt's user avatar
  • 1
1 vote
0 answers
259 views

Python flask webservice can be reached when on LAN, not on WLAN

So I'm running a simple (python) flask web service on the Raspberry Pi @app.route("/", methods=["GET"]) def hello(): now = datetime.datetime.now() timeString = now.strftime(...
Dante x's user avatar
  • 11
1 vote
2 answers
137 views

Problems with I2C communication

Hi I am attempting to test I2C comms between an pi model 4B and teensy 4.1 (running code uploaded from the arduino IDE via usb). While I can read from the slave with a python script if the arduino ...
Shovel_jockey's user avatar
0 votes
0 answers
72 views

raspberry pi 4b, python, opencv, When trying to process video frames the instructions do not run sequentially

I have a problem when executing the programme below, So basically what's happening is when I execute the programme I expect it to open the camera (logitec usb camera) capture a frame, process it, ...
Younes ezouagh's user avatar
1 vote
0 answers
82 views

Thonny Python while loop - output "flashing"

I have a test program I am working on. I am using a Raspberry Pi 4B running Thonny Python controlling an HT16K33 LED Driver via I2C. My code right now is simple: import board import time from ...
Chris Wren's user avatar
2 votes
0 answers
503 views

pigpio Python Raspberry Pi wave PWM generation

I am using pigpio to generate a PWM signal varying in time. I create a wave, which contains one period of a sine wave, in the form of PWM signal. I use wave_send_using_mode and WAVE_MODE_REPEAT_SYNC ...
kubajed's user avatar
  • 21
1 vote
0 answers
403 views

Raspberry Pi and OpenCV. The cv2.error while capture the image through camera lens

https://stackoverflow.com/questions/43572387/error-215-size-width0-size-height0-occurred-when-attempting-to-display-a I have the similar issue with this discussion, after I read it still don't have ...
44 chuang's user avatar
  • 133
1 vote
1 answer
119 views

Measurement in realtime Raspberry Pi 3

I have written a script in python in my Raspberry Pi 3, to get and plot data in real-time from an ADC. The problem is that the data is not time accurate. I want my data to be read once per second or ...
lesandromarteniz's user avatar
1 vote
1 answer
1k views

Could not build wheels for opencv-python which use PEP 517 and cannot be installed directly

I'm trying to install opencv on a raspberryPI 4 (RaspberryPI OS Bullseye x64, Python 9), that is part of installing all the dependencies for this tutorial but it always fails with the error below. I ...
Zmur's user avatar
  • 111
1 vote
1 answer
1k views

Trouble using Tensorflow: SyntaxError

I'm trying to use the LSTM neural network found here on my Raspberry Pi 4 Model B https://machinelearningmastery.com/text-generation-lstm-recurrent-neural-networks-python-keras/ I have trouble running ...
delgado's user avatar
  • 23
2 votes
0 answers
35 views

Moisture sensor gives weird results when connected to a relay

I was about to review the items as faulty when I connected my brain and made a second test. The sensor is supposed to return 0 when dry and 1 when wet. In my script I repeat the reading 100 times. I ...
Lorenzo's user avatar
  • 21
1 vote
0 answers
75 views

RuntimeWarning: GPIO.setup(pin_rst,GPIO.OUT)

My python script was executed in the past 10 days without issues. I had to do some troubleshooting to find what is causing the problem. Here is part of my code where the issue is caused: from mfrc522 ...
Maria's user avatar
  • 11
1 vote
0 answers
116 views

Is there any sound card or ADC for Raspberry Pi 4 available in the market?

The currently used sound card is "HIFIBERRY DAC+ ADC", I want to use the ADC function to recover the "modulated carrier signal (PSK, FSK)", because the "gnuradio" block ...
user19104274's user avatar
1 vote
0 answers
104 views

Adding LUTs and film grain overlays to raspicam

learning python and such by coding and building a camera using the High Quality Camera. Being able to code physical inputs to control the various camera functions was a major win for me, so I don’t ...
Dana's user avatar
  • 119
1 vote
1 answer
291 views

How do I take in recurring snaps from MLX90640 Thermal Camera?

I'm using an MLX90640 Thermal Camera and I got it to work after some time through a Raspberry Pi. What I am trying to do however is take in a picture every minute (or every few minutes) from what it ...
ceilowens's user avatar
0 votes
0 answers
103 views

PIR Sensor Triggering Script Doesnt Loop

I'm using trying to create a living portrait that triggers by motion. The idea is a pi4b connected to a lcd monitor that displays a picture. On motion the picture kicks over to video and morphs. Its a ...
stargazerdood's user avatar
0 votes
1 answer
681 views

Can't install PyBluez2 on Raspbian

Title - I can't install pybluez2: bluetooth/linux/bluez/btmodule.c:20:10: fatal error: btmodule.h: No such file or directory 20 | #include "btmodule.h" | ^~~~~~~~~~~~ ...
Standard's user avatar
  • 113
0 votes
1 answer
656 views

Why am I getting this syntax error in micropython?

I am testing the raspberry pi pico, and am getting a strange syntax error. I have no idea why. from time import sleep led = Pin(25, Pin.OUT) wait = 0.1 while True for x in range(9) wait += ...
Sad Man's user avatar
1 vote
1 answer
312 views

Rasperry Pi 4 - Python i2c Device Not Found

I'm having a hard time setting up a i2c device on a pi4. I did i2cdetect -y 1 But when I run the python code import board import busio import adafruit_ads1x15.ads1115 as ADS i2c = busio.I2C(board....
Jith's user avatar
  • 13
0 votes
1 answer
117 views

pigpio I2C error

I would like to write 16 bits of data to an I2C bus. Considering that the data to be transferred is not in a list, I am using the pi.i2c_write_device() function, however I get the following error: ...
user49706's user avatar
1 vote
1 answer
264 views

RpiZero and RpiPico communication through nrf24l01 not receiving packages

I am trying to implement a wireless communication between RpiZero and RpiPico through NRF24l01 modules. Pico is the receiver, and Zero is the transmitter. I have successfully started the Pico ...
Antifa's user avatar
  • 141
0 votes
1 answer
950 views

pyserial and parity check

I am using pyserial library to deal with serial communications between my CM4 and a particular device. This are my settings: _baudrate = 9600 _parity=serial.PARITY_EVEN _stopbits=serial.STOPBITS_ONE ...
otuga's user avatar
  • 11

1 2
3
4 5
65