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.

Filter by
Sorted by
Tagged with
1
vote
1answer
35 views

Install pypy3 on raspberry pi

I found this to try to help me install pypy3 https://stackoverflow.com/questions/55703832/install-pypy3-on-raspberry-pi However the download command no longer works. I tried: sudo apt-get install ...
0
votes
2answers
53 views

Unable to run bash after boot

I have a raspberry pi 4, EDIT: using python3.7, with raspbian OS Devian 10 Buster and I am trying to run a script afeterboot for people counting, it uses a virtual env, after reading various post this ...
0
votes
1answer
27 views

Rerun the code if error occurs

I am fairly new to coding so please bear with me. I am using random.choice for my code to run. So, sometimes it gives me an error 'Cannot choose from an empty sequence' and sometimes it does not. Now, ...
0
votes
0answers
24 views

I am having trouble with my print command showing “area_room at 0x0000012B26AC88B0” instead of the value of the funtion [closed]

def c_price(): Premium = float(36.00) High = float(21.35) Basic = float(9.32) def area_room(): width = input("What is the Width of the room: ") height = ...
0
votes
0answers
16 views

Real time treshold crossing on slow signal

I need to acquire an analog signal at a slow sample rate (~100 Hz) with ADC connected to Raspberry pi4 with SPI protocol. I've written a Python routine which should detect a real time treshold ...
0
votes
1answer
31 views

Real time + High frequency ADC data reading with Raspberry Pi 4

I need to acquire a signal at a minimum sample rate of 10 kHz and processing it real-time using a Python code. Since Raspberry Pi only reads digital signals I get an ADC (High Precision AD/DA Board ...
0
votes
0answers
37 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 ...
0
votes
0answers
31 views

breaking out of while loop

Trying to stop a light blinking "while" loop by querying the position of a gamepad joystick. Can't seem to continuously query while in the loop and break out of the inner loop. Can you ...
1
vote
0answers
22 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
votes
0answers
47 views

ImportError cannot open shared object file: no such file or directory

I'm on a raspberry pi vm in virtualbox and I'm trying to run some code but I get an import error using tensorflow. I've looked around but I'm not quite sure how to solve this. The package seems to be ...
0
votes
0answers
12 views

Display monitor closes while running a python code on Rpi zero

I am writing a code using the Google AIY vision kit and its APIs. I have a loop which calls the face_detection model continuously every 30 secs. The loop works perfectly fine for the first 2 ...
1
vote
1answer
112 views

Can't install python packages & pip module not found

I've been trying to install packages on a raspberry pi 4b and I keep having issues. On the default, python ver. 3.7, I would get setup.py not found. Then I installed python ver. 3.9 and got the ...
1
vote
1answer
36 views

Waveshare AD/DA espansione board setting sampling frequency

In order to acquire 3 analog signals with Raspberry pi 4 I want to use ADS1256 Waveshare's AD expansion board ( 8 channels single-ended, 24 bit). I was wandering if there's a way to set a different ...
0
votes
2answers
45 views

How should I upgrade the version of Python to latest release [closed]

I would like to re-bind Apache fCGI to python3.7 instead of Python2.7. I saw the following error message while my script used type-hinting. AH00163: Apache/2.4.38 (Raspbian) mod_fcgid/2.3.9 mod_wsgi/4....
0
votes
0answers
19 views

Program stops running while accessing MongoDB in python program triggered using udev rules

I have udev rules file to run a program on usb mount. I am running a bash script automount.sh when USB is connected to Pi. #! /bin/sh cd cd /root chmod 777 /media/USB chmod 777 create_report.py ...
0
votes
0answers
22 views

pyvisa with raspberry pi get Exception: failed to set configuration [Errno 16] Resource busy

I'm trying to comunicate with USB signal generator using pyvisa import pyvisa rm = pyvisa.ResourceManger() dev = rm.open_resource('USB::13062::68:1106200007::INSTR') unfortunately i get an exception :...
0
votes
0answers
16 views

Python GTK application on raspbian lite

I run raspbian lite because I don’t need the complete desktop environment. Actually I like to run my GTK application from the command line. I was trying to install xorg. It does not run... I need some ...
1
vote
2answers
61 views

How to measure raspberry pi energy consumption through programs

Is any Device available in the market that can measure the raspberry pi energy consumption and has a mechanism to read that information from my own program? I explored the specifications of USB meter ...
0
votes
0answers
40 views

Writing software for the RPi without hardware (Mocking/Stubbing)

I have an IoT project that uses the Pi Zero W and at some point want to utilize the compute modules for industrial application. Currently, doing dev I may use a RPi 3/4 to copy files across and run ...
0
votes
1answer
102 views

pygame.error: Unable to open a console terminal

In a .py file this line states "screen = pygame.display.set_mode ( (1, 1) )". It yields an error "error code in python--pygame.error: Unable to open a console terminal". Can ...
0
votes
0answers
24 views

Kivy popup with incorrect graphics

I could not find anything related so I posted the same question on stackexchange to reach a wider range of experts on the matter. On Raspberry Pi4 with Raspbian GNU/Linux 10 (buster) I have Kivy setup ...
-1
votes
1answer
34 views

Odd results when using RPi.GPIO's event_detected() function

I've recently been experimenting with RPi.GPIO's event_detected() function, to check if a button (connected to the gpio) has been presssed. However, for some reason events would randomly be detected. ...
0
votes
1answer
22 views

python modual problem with terminal

I have written this program in python: print("CC ACTIVATED") import lcddriver import time import subprocess from datetime import datetime from pydub import AudioSegment from pydub.playback ...
-1
votes
1answer
49 views

Install Pytorch to RPi (x86? arm?)

I recently study about running some Deep Learning codes on RPis(Rpi 3) so I tried to install Pytorch 1.4.0 on them. However It is quite tough job to do as you may know. I'm so sick of installing ...
-1
votes
2answers
60 views

Keyboard with rc.local

I Have written this python program for my pi. print("CC ACTIVATED") import lcddriver import time import subprocess display = lcddriver.lcd() try: display.lcd_display_string("CC... &...
0
votes
1answer
28 views

Why can I run a python script accessed per php file that is accessed per cmd WHILE I can't run the same thing accessed per browser?

Hello ladys and gentlemen :) I got a python script py.py that switches a GPIO (works perfectly when accessing per cmd line). I got a php file php.php in which I access the py.py file (works perfectly ...
0
votes
1answer
40 views

How to reshape the output stream of the script to make it work for a cvlc stream using Python?

stream.py needs to be changed: import sys import cv2 from picamera.array import PiRGBArray from picamera import PiCamera import time RES_W = 640 RES_H = 480 camera = PiCamera() camera.resolution = (...
1
vote
1answer
28 views

Run a subprocess in administrator mode

I'm trying to add a wifi network on the raspberry pi via bash inside a python script. I want to run a subprocess in administrator mode inside a python application, does anyone have any suggestions to ...
-1
votes
1answer
57 views

Compile exe for Windows using Wine [closed]

I'm trying to use Wine on my RP4 to compile a script as a Windows Executable. Unfortunately I'm not able to install Python 3 on Wine. I could not find any guide on installing python in wine on a RP ...
1
vote
1answer
40 views

RGB LED - Only first color activates when multiple colors are called

I have one RGB LED (common anode type), and while I can get every color to light up independently I am seeing some bizarre behavior when trying to combine colors. This is my first project involving ...
0
votes
1answer
73 views

Run python script on startup and wait for keyboard input [closed]

I know, I know, it looks like the 1000th question about the same thing, but I have tried almost every answer I came across here about running scripts on startup, but they fail to meet my particular ...
1
vote
1answer
57 views

How to reduce the polling frequency of the w1-gpio module on an Raspberry Pi?

I would like to know how to influence the polling frequency of a device on the w1-gpio module. The reason is because I have a DS18B20 temperature sensor on a Raspi that reads too hot. The first thing ...
0
votes
0answers
34 views

Load cell changing over time

I'm using a 1kg load cell beam (see example at bottom) connected to a HX711 board then connected to the Raspberry GPIO. I'm running this Python3 code: https://github.com/gandalf15/HX711/blob/master/...
0
votes
0answers
47 views

How to quit an automatically run script on startup in Python Kivy?

I run a script at startup with the command line @lxterminal -e /home/pi/Desktop/Python3/myApp.sh in the file /home/pi/.config/lxsession/LXDE-pi/autostart which I created with nano, not with sudo nano ...
0
votes
1answer
17 views

Can't append python prints to a file if the .py program is running in the background

I have a Raspberry Pi Zero WH. I wrote a python program import time while True: print("test") time.sleep(2) At the system prompt, /usr/bin/python3 test.py prints fine to the screen. /...
2
votes
1answer
7k views

Updating Python 3.7 to 3.8 [closed]

I recently updated my Raspberry Pi with sudo apt update and sudo apt full-upgrade to the system. Even if Python 3.8 is out, when I run python3 in terminal, it shows me version 3.7, instead of 3.8. Why ...
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: ...
0
votes
1answer
70 views

Converting from RPi.GPIO to circuit python digitalio

I didn't write this code (just made some modifications) but it was using a depreciated library so I'm trying to update to the official circuit python libraries and update everything for python3. This ...
0
votes
0answers
23 views

How to control GPIO pins using python CGI library

I am trying to create a web app with python cgi, cgitb libraries that would be able to interact with the GPIO pins. The application has an html form with a textbox and a submit button. The script can ...
0
votes
1answer
125 views

raspberry pi captive portal

I have created a python flask script that runs on my raspberry pi, I have also configured rpi to switch to access point so when my laptop/mobile gets connected to the AP, I can navigate to the IP '192....
0
votes
1answer
57 views

Wierd output in python from serial connection output

Output: b'00000-000000\r\n' b'450302198011281530\r\n' b'' b'' b'+\x00--To--\r\x12-\x00000800\r\x12-\x00000800\r\x12' b'-\x00000800\r\x12-\x00000800\r\x12' b'-\x00000800\r\x12-\x00000800\r\x12' ...
0
votes
0answers
69 views

vlc python does not play a video in hdmi2

I want to run a video in my second monitor/projector using vlc pip3 install python-vlc and python3 in Raspberry Pi 4. I set the Fullscreen Video Device to HDMI-2 Tools --> Preferences --> Video -...
1
vote
1answer
99 views

Connecting an Arduino Nano to a Raspberry Pi using Serial Cable on an a Pi 3B+ or Zero W

I wanted to connect an Arduino Nano to either my Pi 3B+ or my Zero W preferably my Zero. When I connected my Nano to my Pi Zero and ran a simple script with the python 3 serial library, it didn't work....
0
votes
0answers
71 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 ...
0
votes
1answer
121 views

No module named 'gi'

Recently i have installed Altinstall Python 3.8.0 in /usr/bin. However when i try to from gi.repository import GLib i get: ModuleNotFoundError: No module named 'gi' I have tried many ways (...
0
votes
1answer
36 views

Calculate Accurate Distance Traveled with GPS in Python [closed]

I am trying to update distance traveled between GPS coordinates. My error is that the GPS can move short distances while sitting still. I am currently simply adding the new coordinates to a list every ...
0
votes
0answers
54 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 ...
0
votes
0answers
29 views

Playing videos based on GPIO input Python

I am making a Raspberry Pi(with model 3B) video player that pays a video when an button(from GPIO) is RELEASED. So what I would like to do is when a button is released the video would play. And when ...
1
vote
3answers
74 views

Running Toy Motor circuit with Pi's 5v

I am currently going through the tutorials included with those kits that you can get for the Pis with breadboards and components, etc. Anyway, in the tutorial, I am making the following circuit: In ...
0
votes
1answer
38 views

raspberry pi access point status

I have created an access point on my raspberry pi, now I wish write a python program to check if an access point has been created or not? is it possible to know through command line or python library....

1
2 3 4 5
10