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.

168 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3
votes
0answers
696 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
344 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
270 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
407 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
290 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
48 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
653 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
208 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
0answers
952 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
873 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
8k 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
23 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
40 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
44 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
127 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
46 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
48 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
21 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
33 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
46 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
117 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
314 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
50 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
142 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
47 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
719 views

Get time in microseconds (a 8 digit number) in python3

I am converting an Arduino code to python3. I am trying to read data from IMU 9250 sensor from the I2C interface of raspberry-pi. I am facing issue with the timing libraries of raspberry-pi and ...
1
vote
1answer
630 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
191 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
57 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
71 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
63 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
50 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
47 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
168 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
921 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 ...
1
vote
1answer
310 views

Allowing a venv instance of Python access to I2C

I'm trying to run a python script using the adafruit_bme280 library to read a couple of sensors and display the data on a flask-generated page. I've gotten it to work outside of a venv virtual ...
1
vote
0answers
463 views

Raspberry Pi Touchscreen Screen Control (Python)

I want to create a script that will turn off my Raspberry Pi Touchscreen if nobody touched the screen in 30 seconds. (In the future I want the option to reset this 30 second timer with other programs -...
1
vote
1answer
318 views

Add Touch Mode feature to Minecraft Pi

I have Raspberry Pi 3 Model B+ with 5 inches Display with touchscreen for my challenge [Display works successful!]. I am using Debian Raspberry OS. I am on the file in /home/pi/mcpi/api/python/mcpi/...
1
vote
0answers
103 views

Cant read both SPI Buses of Raspberry Pi 3B+

I want to read 3 analogue sensors simultaneously. I have successfully connected 2 sensors using a MCP 3002 A/D converter which is connected to CS0 of SPI 0 of raspberry pi and I have activated 3 more ...
1
vote
0answers
1k views

Installing scipy on python 3.7 with raspbian

I followed the guides for installing python 3.7 and the installation went without issue, and code I write can run just fine. Installing other modules like numpy and matplotlib doesn't result in any ...
1
vote
1answer
130 views

Can't get HC-SC04 Sensor to work

I'm using a Pi Zero W with a soldered project board to interface two ir Sensors and trying to make an HC-SR04 sensor work. I'm using the 5v supply to power all three sensors. I've set up a Motion.py ...
1
vote
0answers
108 views

MPR121 capacitive touch is sensible enough?

I have a Rapsberry Pi 3 A+ with an Adafruit Capacitive Touch HAT for Raspberry Pi (MPR121) and the idea is to plug it to the wet soil of a plant and it detects when I touch the plant (or a leaf) and ...
1
vote
1answer
409 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....
1
vote
0answers
250 views

raspberrypi3 bluetooth socket problem

I have write program for raspberrypi3 bluetooth communication with hc05 ,but most of the time I am getting error bluetooth.btcommon.BluetoothError: (110, 'Connection timed out') how can I solve ...
1
vote
0answers
127 views

PiCamera python : buff/cache memory keeps increasing

I need to take a picture in each second in an infinite loop. I've wrote 2 different python scripts: one with camera.capture() and another with camera.capture_continuous() In both cases, I see the ...
1
vote
1answer
203 views

Accessing a Virtual Environment from IDLE3 shell?

On my pi3 I have created a virtual environment with Python3. I run my pi headless, using my Windows 10 PC. I access the pi with 3 apps: - PuTTY for terminal usage; - WinSCP for a file Explorer; and ...
1
vote
0answers
420 views

Not able to install the latest version of Scipy(1.2.0) on Raspbian

I have Scipy version 0.18.2 on my RaspberryPi 3. However, I need the find_peaks() function which is only available on higher versions. I followed this link to install scipy. But the python3 setup.py ...
1
vote
0answers
152 views

Pi-3, Model B, SenseHat - How can I restart my code while it's active.?

I am new with python and PI. I have been looking all over for information about this but with no luck. currently it works like this: I start the program, I press the button and then it starts counting ...