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.

198 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3
votes
0answers
776 views

Accelerated Numpy on Pi 3 B+

I'm looking to do some work with NumPy on my Pi 3 B+, and I'm not sure what the deal is with optimization, blas, etc. I installed libatlas using: sudo apt-get install libatlas-base-dev Following ...
2
votes
0answers
524 views

ALSA errors on raspberry pi 4

So i'm trying to make a virtual assistant on a raspberry pi 4. I have coded the bot to work on my windows machine but now I'm running into errors while using the raspberry pi I figured out which part ...
2
votes
0answers
547 views

Installing cv2 for python3.7

I've been trying to get opencv to work on my raspberry pi zero w but no matter what I do it doesn't work. I'm using Raspbian Buster Lite (headless) and each time I fail to get opencv to work on the pi ...
2
votes
0answers
784 views

Hardware controlled RTS on a Pi4 not working accurately

We need to use RS485 to talk to one of our custom tools. We need to use hardware controlled rts/cts. I've read so many articles about this but nobody ever says it works for them with fast timing and ...
2
votes
0answers
557 views

Waveshare ADDA (ADS1256) full scale input issues

My question is about a problem of full scale output with the Waveshare ADDA ADS1256 card. I use the Waveshare High-Precision AD/DA Board based on ADS1256 on a Raspberry Pi 3b and the Python3 examples....
2
votes
0answers
51 views

How to run 3 Input scripts from 1 script

I've got an alarm system with 3 inputs and 3 outputs. But so far each input is controlling the outputs from it's own script. I did this because I wanted to get one thing at a time working on its own. ...
2
votes
1answer
1k views

Pigpio not calling Callback for first rising or falling edge

I have some sample code (taken out of my larger program) that regularly (but not always) missing the first rising edge: #!/usr/bin/python import pigpio, time def callback(g, l, t): print("Callback ...
2
votes
0answers
313 views

Detecting “No Mouse Movement” in python on Raspberry Pi

So this is going to be a bit confusing but using a basic loop i can detect keyboard and mouse inputs using the following: globals()['keyboardEvent'] = evdev.InputDevice('/dev/input/event0') globals()...
2
votes
1answer
552 views

Retrieve data from Smart Plug via Raspberry Pi (need help with python script)

I am using a tutorial from BeardMonkey in order to retrieve and store the measured data from a smart plug (a smart plug is monitoring the power consumption of my kettle at the moment) https://www....
2
votes
0answers
1k views

Difference between Thonny and Python 3 (running some code)

I'm just starting with the pi and to be more clear I'm spending time working with the Raspberry Pi Workshop for Beginners series on Youtube.To write an run code we use the Python 3 IDE but I don't ...
2
votes
0answers
919 views

Enabling I2C resulting in error Raspberry Pi

I am trying to use MPU 6050 on raspberry pi. For that I enabled i2c on raspi. But after that whenever I am trying to check the modules on my Python 3 or 2 shell for e.g. when I run help('modules'), I ...
2
votes
0answers
2k views

Segmentation fault, running out of memory? PyQt5

I am programming code to display camera feed with my raspberry pi 3 and Raspbian. Strangely, sometimes the code shows the video and sometimes i get the Segmentation fault error. I used gdb to find ...
2
votes
0answers
9k views

Want to Read COM Port Data and Write into TKinter Text Window

Using Python3, I want to read data on a serial port and display it into a tkinter GUI text window (not only the shell). Pretend I am trying to make the equivalent of a serial port character display. ...
1
vote
0answers
21 views

heartbeat sensor for pi

i want to measure the heartbeat using the pulse sensor. i connected the pulse sensor to a mcp3008 adc and the pi. this is the code i used from pulsesensor import Pulsesensor import time p = ...
1
vote
0answers
56 views

GPIO pins not working properly

i've recently started a small project where i want to controle an LED-strip with an webapp using a respberry pi. While the webapp works perfectly fine, i ran into a problem with my pi zero w. Since ...
1
vote
0answers
30 views

Redirecting log entries - where have I gone wrong

On a Pi Zero, I have two python scripts set up as systemd services. Each has a .service file in /etc/systemd/system. Each has a .conf file in /etc/rsyslog.d that is intended to redirect syslog ...
1
vote
1answer
636 views

Raspberry pi interfacing with AD8232 using python

I have already seen the other post but I want a python code through with I can connect my raspberry pi and ECG sensor ad8232 I am totally new to raspberry pi interfacing so I don't completely ...
1
vote
0answers
117 views

How can I make the Raspberry Pico not automount as USB storage while using Circuit Python

I am using Circuit Python on a Raspberry Pi Pico to give me hardware buttons for keyboard shortcuts. I am using Circuit Python as opposed to MicroPython because it has the USB_HID library. I don't ...
1
vote
0answers
62 views

Tkinter Script Autostart

I have a problem with loading the Tkinter script at every reboot of the Raspberry. The script is executable and starts from a .desktop file. No problem with it when the Raspbian OS is booted (I guess ...
1
vote
0answers
63 views

Can keyes Sound sensor be used as a Microphone in Raspberry pi?

I am trying to make a speech recognition system on a Raspberry Pi 3 model B+ using Python. It needs a microphone. I have the keyes Sound sensor which looks like this(https://cutt.ly/Jjp9jWP). Can this ...
1
vote
0answers
386 views

Problem with USB RFID Reader and Raspberry pi 4

Firstly I'm just a beginner trying to get into pi world so my knowledge is minimal at this point. I'm trying to make USB RFID card reader work on raspberry like it works on my Windows pc, imitate ...
1
vote
0answers
2k views

RTSP streaming works in VLC media player but not in Python OpenCV

I have Logitech C920 USB webcam connected to my rPi 4 4GB model. I want to stream the video feed through rtsp. The following command runs on the pi: cvlc -v v4l2:///dev/video0:chroma=mp2v --v4l2-width ...
1
vote
0answers
40 views

Connecting a phone to a Pi 3A+ using Bluetooth fails

I want to connect my phone using BLE to a Pi 3A+. For testing I have set up a Bluetooth server using this code. I have tried connecting with nRF Connect on both a Motorola Moto e5 (Android 8.0) and a ...
1
vote
0answers
227 views

How to make python3 aware of manually compiled opencv?

all this is on a 4Gb RPi 4GB. I compiled opencv from source following this guide and it built and compiled ok. Running opencv_version reports 4.4.0-dev. But in python3 when running import cv2 it says: ...
1
vote
0answers
437 views

“wlan0: carrier lost” untimtly WiFi deconection on raspberry pi 3b+ and pi0 W

I am facing this bug since few days. I am using: Rpi 3b+ or Rpi0W, Buster-lite with last update, Kernel : 4.19.118+ I using Ubiquti WiFi AP and dnsmasq for managing the lan, both working normally with ...
1
vote
0answers
160 views

I2C, SPI and Python Libraries with Raspberry Pi 4b

I've been working with RPi.GPIO so far but I have had issues with PWM and edge detection, which are well known issues with RPi.GPIO, anyway, after some research I'm considering using a different ...
1
vote
1answer
692 views

Raspberry Pi notorious problem = cannot find INSTALLED module

I could not use module keyboard, I have check using python3 -m pip list to check the pip packages that I have installed and I saw that I have installed keyboard 0.13.5, however after I execute this ...
1
vote
0answers
87 views

NeoPixel library slow with large number of WS2812B LEDs (Raspi3)

Noob here, I am currently working with a 10m long strip of 144LED/m density LEDs. The problem is with such a high number of LEDs loops (like a color wipe for example or filling LEDs one after another) ...
1
vote
0answers
111 views

How to run " import serial" and "import cv2" in one python file?

I am actually creating my project wherein I can control my raspberry pi in my pc using FPV Radio Telemetry. The scenario is my pc will send string data like "red" and "blue" to my pi. After my pi ...
1
vote
0answers
268 views

pigpio hardware PWM for servos

My goal is to build a pan/tilt system. this works fine: import pigpio pi = pigpio.pi() pi.set_servo_pulsewidth(13,1055) 2 questions: is pi.set_servo_pulsewidth using hardware PWM (I prefer HW PWM) ...
1
vote
0answers
147 views

Change Default Microphone

I am having trouble changing my default mic on raspbian buster lite (kernel 4.19.36 on the 3B+). I know that the mic is fully functional because when I run: arecord -D plughw:1,0 --duration=3 test.wav ...
1
vote
0answers
114 views

GUI with tkinter, 2 buttons touched together

Have written a GUI (touchscreen) for my Pi in Python 3 with tkinter. It works in fullscreen. I do not want to have an extra button for shutting down the Pi but when I push 2 buttons together. How can ...
1
vote
0answers
46 views

pigpio servo, stop command not reliable

import pigpio import math import RPi.GPIO as GPIO from gpiozero import Button import time GPIO_SERVO_PIN = 27 limit = 17 switch = Button(limit) GPIO.setmode(GPIO.BCM) GPIO.setup(17, GPIO.IN, ...
1
vote
0answers
36 views

Raspberry pi: How to toggle a thermal heater

I am trying to build a thermal heater and controller. I have a thermal blanket (https://www.adafruit.com/product/3670) and I would like to be able to control the current to the blanket by control it ...
1
vote
0answers
60 views

display a cross-hair within a picture with python3

I want to add a cross-hair pointing to a position within a picture frame and display it. How could this be done effectively using python3? Which library would be preferable?
1
vote
0answers
227 views

Why does native resolution capture with picamera raise 'Incorrect Buffer Length' for Arducam 8MP with IMX219 sensor?

I am trying to capture() full resolution images using picamera.array but it fails raising a PiCameraValueError: Incorrect buffer length for resolution 3280x2464. camera.MAX_RESOLUTION gives ...
1
vote
1answer
637 views

Raspberry Pi 4 to Mitutoyo Digimatic interface

I've been trying to interface a Mitutoyo digital caliper. I used the code from here and I think I made the right corrections according to the posters comments but as I checked he was last online in ...
1
vote
0answers
92 views

PiGpio – pass through binary data

I have two ports connected to GPIO on a Raspberry, where I read and send data NMEA sentences to external equipment using the PiGpio library in python, and this is working fine. Now I need to transfer ...
1
vote
0answers
205 views

Is there a way to stop Pyaudio and omxplayer from printing info

I am trying to create an application which uses wakeword with snowboy and speech recognition using the speechRecognition library in Python. When I start my scripts, when say I my wake-word - 'Python'...
1
vote
0answers
91 views

"Attribute Error"- How to display data from distance sensor on lcd display?

I am trying to incorporate LCD display features with the codes that are already written for the sensor. "lcddriver.py" is in "lcd". "distance.py" contains codes for my distance sensor. This is the ...
1
vote
1answer
1k views

imutils VideoStream(src=0) return VIDIOC_QBUF: Invalid argument in raspberry pi

I am only doing a simple code in my Raspberry Pi 4: from imutils.video import VideoStream # initialize the video streams and allow them to warmup print("[INFO] starting cameras...") webcam = ...
1
vote
0answers
279 views

Raspberry camera v1.2 results in kernel panic

Update I have found the following issues that might relate to this problem: Framerates below 1 are not supported (https://github.com/raspberrypi/userland/issues/575) Frequent sequential call hang (...
1
vote
0answers
90 views

Schedule Video Recording

The code below records video for 24 hours straight which is too much. I wanna schedule the record like from 9.00am to 3.00pm only 6 hours of video. Being a novice and newbie I don't really know how to ...
1
vote
0answers
136 views

I don't know why suddenly mjpg-streamer and webcam stop working

I have made a program that uses three webcams and three ultrasonic sensors using raspberry pi 3 and python 3. When each ultrasonic sensors detect stuff in front of them, webcam take a picture of it. ...
1
vote
0answers
134 views

softly increasing and decreasing volume with mpg123

I am using Picroft on raspberry pi 3. In picroft, every mp3 files run with mpg123. I am creating my own device using this OS. when I say it to sing a song it starts singing by playing mp3 files and ...
1
vote
0answers
3k views

ALSA Errors on Pi 3B+ using SpeechRecognition and PyAudio (Original Post missing stuff)

Using PyAudio I simply ran this piece of code: import pyaudio p = pyaudio.PyAudio() for x in range(p.get_device_count()): print(p.get_device_info_by_index(x).get('name')) Getting these Errors: ...
1
vote
0answers
64 views

Making Python3 default on command line

I have been trying to run the Jupyter notebook on my Pi but the Kernels will not install into Jupiter even though I downloaded them through the Pi's Software download window. A little bit stumped and ...
1
vote
0answers
76 views

Launch a python script in a lxterminal window using supervisord

I'm trying to launch a python script in a lxterminal window using supervisord. I'm stuck on using supervisord than a .desktop file. I'd like to keep the process running on loop Below is my config: [...
1
vote
0answers
249 views

How do I access pixel values from a raspberry pi camera?

I am writing an AI program in Python on a raspberry pi, where I need to access raw individual pixel values from a raspberry pi camera. I really don't want to save the picture, I want to process the ...
1
vote
0answers
1k views

A PWM object already exists for this GPIO channel

I have a bit of a dilemma. I am currently using BCM GPIO 14, 15 and 18 to control an RGB status LED using PWM. I have configured my raspberry pi 3 to pull down pin 14 (red) on boot, to indicate the ...