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.

863 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5 votes
1 answer
222 views

Problem sending analog read values over serial

Ok I apologize as I have edited this quite a bit, but I have narrowed down the problem a bit more. For some reason I can't transfer values from my arduino analog pins?? I am trying to send values ...
MattG's user avatar
  • 193
4 votes
1 answer
7k views

Alsa lib error pyaudio on raspberry pi 3

I'm getting these ALSA lib errors when trying to use pyaudio. I know my mic works as I can live stream audio through gstreamer. Can anybody explain to me why i'm getting these issues: ALSA lib ...
Tom F's user avatar
  • 41
4 votes
0 answers
795 views

RPI 3B and Tiny Thermal Printer - Unable to use python library

I'm having trouble hooking up my Raspberry Pi 3 Model B to my Adafruit Tiny Thermal Printer (nb: not the mini thermal printer - this is the one with a mini-USB port built in). I've got it connected ...
Tom Harris's user avatar
4 votes
0 answers
457 views

Speech Recognition ERROR

I am using a speech recognition library on a Raspberry Pi in Python that I found here and I installed it through pip. I also had to install Pyaudio of their site here. Pip would not work for Pyaudio ...
NeverAsleep - AlwaysAwake's user avatar
3 votes
0 answers
189 views

ADXL345. Bits, resolution and g's

I have a Kistler type 8921 which produces 1g (10m/s2) RMS (at 159 Hz). The ADXL345/Raspberry Pi 3 setup should produce similar g's, but currently doesn't. As can be seen, it is not just about a ...
User4536124's user avatar
3 votes
1 answer
2k views

Raspberry Pi 3 & Arduino: [bluetooth.btcommon.BluetoothError: (112, 'Host is down')]

I am trying to send informations from Raspberry Pi 3 to Arduino Uno with bluetooth. I managed to connect the Arduino's bluetooth module with the Raspberry Pi. But I have this error when I execute my ...
mkfahmi's user avatar
  • 31
3 votes
1 answer
419 views

How to make sense of this Raspberry Pi project guide for building a theremin?

I have just started out using a Raspberry Pi, and for my first project, I wanted to build a pseudo theremin using an ultrasonic motion detector and other electronic components (requirements are laid ...
Bob McBobson's user avatar
3 votes
1 answer
711 views

Is it possible to connect a Minecraft Pi Edition Python script to a specific active game window?

Is it possible to connect a Minecraft Python script to a specific active game window when multiple game windows are currently open? For example, I have three different open games on one Raspberry Pi ...
ThisClark's user avatar
  • 171
3 votes
0 answers
799 views

Raspbian Reboot Hangs

Having a bit of a problem on Raspbian Jesse. I have 2 switches which I use to shut down and restart my raspberry pi. Python does an os.system ("sudo reboot") and os.system("sudo shutdown -h now") on ...
Joachim Prinsloo's user avatar
3 votes
0 answers
807 views

RPi.GPIO autocompletion

Is there any way to have auto-completion when working with the RPi.GPIO in Python? I don't see it having any Python sources that could be used for it. I'm using IntelliJ IDEA, which uses PyCharm's ...
Łukasz Zaroda's user avatar
3 votes
0 answers
2k views

Raspberry Pi 3 Bluetooth Baud rate

How do I increase the available baud rate of the bluetooth module for the Raspberry P1 3 model B? I have tried editing the /boot/config.txt file with: init_uart_baud=1000000 init_uart_clock=16000000 ...
mlawes's user avatar
  • 31
3 votes
0 answers
2k views

Emulate a Bluetooth Keyboard with a Raspberry Pi 3

Raspberry Pi 2 Model B (Raspbian Wheezy and bluez 4.99) Executes perfectly using a Bluetooth dongle. Raspberry Pi 3 Model B (Raspbian Jessie and bluez 4.99) Attempting to pair with Windows laptop ...
Yousef Abdelsalam's user avatar
3 votes
0 answers
4k views

Jack server not working on Raspbian

I wrote a little python app (using PyDub), that plays sound files. Everytime I run it, I get the these errors: ALSA lib pulse.c:243(pulse_connect) PulseAudio: Unable to connect: Connection refused ...
Cisc's user avatar
  • 31
3 votes
0 answers
707 views

Running two cameras at the same time (Pi Camera & USB camera)

I would like for my project to have one camera (PiCamera) Streaming video. And another USB Camera (PS3 Camera) taking pictures when I execute this function: def grabPicture(self): grab_cam = ...
Bobys's user avatar
  • 133
3 votes
0 answers
1k views

OpenCV. Can't open video from usb camera on the screen

When I'm trying to start simple code, the frame opens and don't respond. import numpy as np import cv2 cap = cv2.VideoCapture(0) while(True): ret, frame = cap.read() cv2.imshow('AIR',frame) ...
MashkovtsevLx's user avatar
3 votes
0 answers
290 views

Slice of Radio and Ithobox

I've got a Raspberry Pi with Ciseco Slice of Radio and I'd like to control my Ithobox LINK It has an 868 Mhz RF transmitter/receiver and I also have the optional RF remote control unit which I'll be ...
user3675572's user avatar
2 votes
2 answers
98 views

Make screenshot of a program without being connected to a monitor

I am working on a project at a company where I read the temperature of a machine with a raspberry pi. I have downloaded the necessary program and can use it through Wine. In addition, I have made a ...
Niels's user avatar
  • 21
2 votes
0 answers
1k views

Postgres ERROR: SSL SYSCALL error: Connection timed out

I wanted to develop an app with Python that would run on a Raspberry and be remote controlled. This app should control (switch on and off) 2 leds based on the current day, time and the user's ...
Jiannis4's user avatar
2 votes
0 answers
197 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
0 answers
219 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
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
2 votes
0 answers
65 views

HQ camera hanging after gpu_mem is increased

I just recently got a Raspberry Pi HQ camera and wanted to operate it using a python script. I initially tried to take full resolution pictures using the default gpu_mem=128, but the program crashed ...
PMM's user avatar
  • 131
2 votes
2 answers
306 views

How to send data to a Pervasive eink display via Python?

I got a 5.8" eink display from Pervasive Displays and cannot get it to work, I feel that only a little bit is missing. After a lot of struggle I managed to run it via their sample C code, but the ...
sydd's user avatar
  • 73
2 votes
1 answer
145 views

Inconsistent error using HQ camera

I have been having some issues using the HQ pi camera. I am running Rasbian 11, latest apt update 11 march 2022. I use libcamera-still to take images and I call this command using python subprocess....
Olaf's user avatar
  • 41
2 votes
0 answers
301 views

High-speed USB Audio Streaming

I am using a Raspberry Pi 3B+ as the USB host for an embedded device that I have configured to appear as a USB Audio 2.0 compliant microphone. I am currently using PyAudio for opening and recording ...
Ali Rahman's user avatar
2 votes
1 answer
809 views

How do I use NumPy and Pandas in my virtual environment?

I'm using Raspberry 4 to host a web service with FastAPI. In my code, there's a dependency on Pandas. When I ran the web service, it gives me the error message below: File "/home/pi/Projects/...
BurgerBurglar's user avatar
2 votes
0 answers
2k views

How to make sure BlueZ NoInputNoOutput agent does not ask for user authorization?

I am trying to pair my custom made BLE device with a Raspberry Pi 4, using the bluepy library, programmatically. I do not want to press "accept" or type "yes" whenever I try to ...
robino16's user avatar
2 votes
1 answer
47 views

Bluetooth Ignition need help smoothing out functionality

I have been working on a Bluetooth authorized push to start the ignition in my truck. Right now it's installed and working but I would like to change the function of the button and shorten the time it ...
Citsk6's user avatar
  • 21
2 votes
0 answers
237 views

pi zero portable mp3 player software

i am thinking about a project for which i could use some guidance. i want to build a flac/ high bitrate mp3 player with nice clicky buttons and rotary encoders. i have a raspberry pi zero, a dac hat ...
balu's user avatar
  • 21
2 votes
0 answers
471 views

pySerial - UART - Determining when a message has actually been sent (callbacks?) (RTS/CTS hacking?)

For reasons (explained at the end of the post) I need to have a pin change state immediately as the UART finishes outputting a set of bytes. I'm using pyserial & pigpiod on a RPi3B+ and bluetooth ...
Mudf4ce's user avatar
  • 21
2 votes
0 answers
161 views

Input() called from GPIO input (button press) returns error

I'm learning Python whilst tinkering with various 'kits' I got for my Raspberry Pi. Currently messing around with the RFID-RC522, a simple to use RFID read/write board. I have independent Write.py ...
Joe L's user avatar
  • 21
2 votes
1 answer
293 views

Remote Debugging Raspberry Pi 0W

Using Visual Studio to debug python applications on a Raspberry Pi 2 or newer is a real convenience, but Visual Studio Code does not support debugging on Raspberry Pi 0 or 0 W because of the older CPU....
Stealing's user avatar
2 votes
0 answers
947 views

Getting "has no 'x' member errors" for Rpi.GPIO using vscode remote ssh extension

I just set up my raspberry pi and have been using vscode (remote - ssh extension) on my windows computer to code on there but I have been getting errors like "Module 'RPi.GPIO' has no 'output' ...
Juan's user avatar
  • 21
2 votes
2 answers
529 views

I cannot install opencv

I just bought a new camera for my pi so I installed it and then I wanted to test it out so I got a simple python program to test it: import cv2 as cv def testDevice(source): cap = cv.VideoCapture(...
Roger's user avatar
  • 21
2 votes
0 answers
642 views

adafruit_drv2605 AttributeError: object has no attribute 'try_lock'

I am using a Texas Instruments DRV2605 to drive some haptic motors. I am using the Adafruit library here to communicate with the DRV through Python. I need to set some bit registers of the chip but ...
Bassline Soup's user avatar
2 votes
1 answer
704 views

Create Overlays with DispmanX in Python

How can i create preferably dynamic overlays using Dispmanx in Python on a Raspberry Pi (3B)? My goal is to overlay custom images containing current information on top of a Picamera Preview. The ...
MCRob2's user avatar
  • 21
2 votes
1 answer
2k views

How to display an image full screen on my second monitor (raspberry pi 4)

I am using RPi 4 and running two monitors. I want to display an image on the second screen using Python or Linux command line. I have tried but I couldn't do this with fbi(it displays on the both).
A . Jahangiri's user avatar
2 votes
0 answers
706 views

How to add 2 RFID readers to Raspberry PI 4

I managed to install 1 rfid reader following this link tutorial but i have no idea how to read with 2 and know from which one reads
ikenas's user avatar
  • 121
2 votes
0 answers
431 views

Raspberry Pi stops running cron job after a few hours

My raspberry pi 4 is set to run a python script every hour that turns on some philips hue lights and takes a picture with the camera module. It worked perfectly for 26 days, then it stopped running. ...
John's user avatar
  • 21
2 votes
0 answers
223 views

Sending an image from Pi Camera continuously to a display

I want to send 6 images per minute from the Pi Camera continuously to any display. Like for say I have the camera that is at my house but I want to send the images to my work computer. The end goal ...
kassidylynnk's user avatar
2 votes
0 answers
81 views

Raspberry Pi Jsch Diconnect Handler

I am using Android Studio "Jsch" package to connect my Android Device to my Raspberry Pi via SSH. The Event "on press" sends a command,which executes a Python file on my Raspberry Pi. This File turns ...
Paraton44's user avatar
2 votes
0 answers
47 views

Error opening InputStream USB Microphone and Raspberry PI3B+

I am trying to use a USB microphone with python sound device and raspberry pi3B+. When I execute the script in the console typing $ python3 sound.py it runs and records all ok. But when I try to ...
Fabiana's user avatar
  • 21
2 votes
0 answers
236 views

Using Motion to Post Photos Captured to API

I am attempting to build a program that will automatically post the photos taken by motion from my usb webcam to a rest API, and have ran into some problems. My livestream works correctly, and it ...
jakeant2's user avatar
2 votes
0 answers
1k views

picamera: capture a frame while continuous capture in background

I'm capturing a timelapse with the picamera module for python: def capture_thread_task(self): filename = os.path.join(self.SAVEPATH, self.safe_camname + '_{timestamp:%Y%m%d-%H%M%S}-{counter:03d}'...
Gui13's user avatar
  • 103
2 votes
0 answers
4k views

Updating python version3.6 to python 3.8.1

currently, my raspberry pi runs python versions 2.7 and 3.6 [by default] and version 3.8.1 [I'm trying to update the current version] This causes a lot of trouble when I try to install a new package ...
Mat brightington's user avatar
2 votes
0 answers
44 views

Permanent Arduino usb address on RPi!

So my project is using to Arduinos slaves to RPI that is master. They communicate through USB. Each time I remove one of the Arduinos I need to modify the .Py script to add the new USB alocated. Is ...
Andy Andy's user avatar
  • 131
2 votes
1 answer
279 views

Timed trigger for GPIO input

I'm running a raspberry pi system that records fish as they swim passed an IR break beam sensor at a fish ladder. So far the system works well but I'm trying to cut down some of the false triggers. ...
kemistree4's user avatar
2 votes
0 answers
131 views

PWM on pump not working as expected

I am attempting to run a PWM on a pump using rpi.GPIO using the following code: def run_PWM_on_pump(): gpio.setmode(gpio.BOARD) gpio.setup(8, gpio.OUT) p = gpio.PWM(8, 0.5) #also works at ...
Tmello225's user avatar
2 votes
0 answers
205 views

Adafruit OLED (128x64) display very dimmed?

I bought the Adafruit 128x64 OLED Bonnet and tested it with the demo program. Unfortunately the luminosity is very low and it is not satisfying: I have tried to adjust the contrast from 0 to 255 but ...
nowox's user avatar
  • 219
2 votes
0 answers
224 views

Safe cut power supply from raspberry

I want to cut safe the power supply from the raspberry with a relay connected to the gpio. I know how to connect to relay to the board but.. When the relay turn off the power line will be cut off to ...
Jordy van den Berg's user avatar

1
2 3 4 5
18