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
0
votes
0answers
5 views

Can I save and open multiple videos with OpenCV or any other module/package/method

So, I have been working on a project which requires me to open an animation/video if the user gives an input of a recognized string mentioned in my code. Basically if the word entered by the user is ...
0
votes
0answers
9 views

How to Volume control PAM8610 from RPI

Does anyone know how can I control PAM8610 module volume through code from RPI? Thanks.
1
vote
0answers
21 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 ...
0
votes
0answers
18 views

Simulating OpenCL on a Raspberry Pi using Python

Is it possible to run code on a Raspberry Pi which simulates the use of OpenCL? I am developing code on a computer which is capable of using OpenCL, and am testing this code remotely on a Raspberry ...
2
votes
1answer
26 views

Reading more than 8 bits from an SI7021 sensor

I am using the Si7021-A20 sensor on a Raspberry Pi Zero WH (headless, controlled via ssh and VNC). I want to get readings using Python (version 3). However, I have a very hard time to actually get ...
1
vote
1answer
2k views

Raspberry Pi 3B+ freezes randomly

General setup My RPi is connected to a mouse, keyboard, and monitor. My swap size is set to 1000 MB and I'm not using wifi. Problem The RPi freezes randomly, meaning the GUI is frozen, no SSH ...
0
votes
0answers
28 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
1answer
78 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
2answers
50 views

Raspberry Pi “Temporary failure in name resolution”

After many hours of googling and testing for a solution, I am stuck. I would really appreciate some advice. Situation - I have (5) Raspberry Pis 3B+ (RP) at various customer locations and I want to ...
0
votes
0answers
10 views

Binding PiCamera stream to GstWidget

Well, today I began to program in Python and I'm doing a graphical app with PyGtk in Anjuta. My first objective is to get the stream of the PiCamera in a window. But I'm getting problems to manage the ...
0
votes
1answer
327 views

Multithreading Python Raspberry Pi 3 B+

My Raspberry Pi 3 b+ is reading by Modbus the values of an irradiation sensor, processing all the data, showing it in a plot and showing some warnings (if the irradiation ramp is higher than 5%). I ...
0
votes
1answer
53 views

Serial read from arduino not working properly

I am trying to read analog read from ardunio connected to my raspberry pi. Following are my raspberry pi and arduino codes. Raspbery pi: import time import serial ser = serial.Serial('/dev/ttyACM0'...
0
votes
0answers
20 views

Detect fire with pi cam module

I have a python script that uses a usb cam to detect fire with opencv, it worked well until changed to the picamera and now i get this error when i run the code: File "seeFire.py", line 23, in ...
2
votes
0answers
26 views

Pin Crosstalk Issue

I'm working on a quick project with my dad for his condo. He wanted to setup a bunch of moisture sensors around the condo near sources of water (sinks, bathtubs, toilets, etc), which, if triggered, ...
0
votes
1answer
75 views

Tkinterhtml fails to run on raspbian. Python 3.7

Tkinterhtml fails to run on Raspbian. Python 3.7 _tkinter.TclError: couldn't load file "/usr/local/lib/python3.7/site-packages/tkinterhtml/tkhtml/Linux/32-bit/Tkhtml/libTkhtml3.0.so": /usr/local/lib/...
1
vote
1answer
100 views

Connecting a new Bluetooth device without monitor?

We are trying to connect a Bluetooth device without a passkey and trusting default yes in Python. I am running a headless Raspberry PI 3, and I want it to automatically accept pairings from any ...
1
vote
1answer
26 views

How do I reinstall Python 3?

I cannot get pip to work and I think that reinstalling python 3.7 might help. When I try 'sudo apt install --reinstall python3' I get an error saying there are unmet dependencies. If I specify it to ...
0
votes
0answers
17 views

error while opening the default python3 install in raspbian

well, i have been using python3.4.2 for sometime on my raspbian os however recently i tried to change the default to 3.7.2. unfortunately i failed to do so... i downloaded it but i couldn't make it ...
0
votes
0answers
22 views

php file not executing python script when called through browser

I have an apache2 webserver running on the pi. I have a php file that uses exec() to run a python script. Everything works well from the command line. when loaded through the browser, the exec() ...
0
votes
0answers
18 views

Simulate a mouse click in python tkinter

I have a tkinter GUI running on a Pi 3B+ with a 5" tft touch screen display. I am writing my own touch screen driver. The GUI works when I mouse click on a button that is bound to Button-1. self....
0
votes
1answer
71 views

Failed to load a keras model to my raspberry pi3 b+

I am trying to load a keras model to do classification task using my raspberry. But after running this code: import keras from keras.models import load_model model = load_model("mobilenet_v2_3(...
2
votes
1answer
18 views

CE1 not going low for pigpio.spi_open() with flags

I'm attempting to modify joan's test script (https://raspberrypi.stackexchange.com/a/44320/42126) for an RPi SPI master to communicate with an Atmega328P slave. I cannot change which GPIO pins I have ...
1
vote
1answer
224 views

how to install protobuf in raspberrypi3 b+ stretch?

Anyone can suggest me how to install protobuf in raspberrypi 3 b+. if I directly install using the command pip install protobuf it is install but I am not able to import ?
4
votes
3answers
171 views

Launch a GUI Tkinter program on boot

I am trying to auto launch a Tkinter/Python program when the Raspberry Pi boots up. Ideally I would like to boot the Pi into the console and then launch a GUI Tkinter Python program. In testing – not ...
0
votes
0answers
29 views

My Relay suddenly turns on and off, and this happens in a second

Well, I had written a code for Automatic Cooling with DHT 11, but I did not get any successful result in it, I want the Relay turn on when the humidity rises up, and I did not have any errors in my ...
0
votes
0answers
159 views

pigpio python serial wave output not correct

I am trying to use joan's pigpio to write a serial command on my Rpi 3 gpio 14(UART0TX).My goal is to write a command from the pi to another device. When i send the command i do not see the ...
1
vote
1answer
29 views

Timeout function for user input on 4x4 membrane keypad with pad4pi

I'm making a python script for a 4x4 keypad that's connected to a raspberry pi where the user enters a 4 pin code and the program tells the user whether or not it's correct. In order to take in the ...
1
vote
0answers
26 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
1answer
149 views

Camera pretrigger capture

Hi i want to make a program that will continually record a video and on a press of a button, it will save 2 minutes before i pressed the button is it possible to do it somehow ?
1
vote
2answers
49 views

Detecting device path for USB scanner

I'm currently exploring ways to detect the correct device path (for ex: /dev/input/event0) for an USB scanner. With the following code in Python using the evdev package, I am able to filter down to a ...
0
votes
0answers
22 views

Start python server and Vue front end at boot

I'm trying to have my raspberry pi start a python server with connected Vue.js frontend at startup. Right now i'm using crontab with the following configuration: @reboot sh /home/pi/Desktop/server-...
1
vote
1answer
33 views

RPI project Minecraft Server

me and a project partner are running a Minecraft server off of a RPI and connecting via its wireless feature. we wanted to create a python script which would control an LED and toggle it on/off based ...
-1
votes
0answers
22 views

About Pi Camera show in Canvas at GUI Python (Thonny Python)

I'm a newbie with raspi. Can someone help me with pi camera? My goal is that the pi camera image is shown in the Canvas of GUI (Tkinter) from Python (thonny python). I'm very confused here.
-1
votes
1answer
118 views

Python urllib won't work from ~/.bashrc

I have the following code in a file called ~/foo.py: import urllib.request url = "https://raspberrypi.stackexchange.com" req = urllib.request.Request(url) resp = urllib.request.urlopen(req) It runs ...
0
votes
0answers
19 views

Cannot turn web streaming into a function

I'm working on a project with my Raspberry Pi 0 and a camera. I'm writing my code in Python using the PiCamera module. This file handles setting up the camera and Starting Web streaming. I had no clue ...
2
votes
1answer
29 views

Why no result from os.popen() when script is run from crontab?

When I run this Python3 script from the command line or from Thonny I get correct results. When I run it through crontab the variables ipaddress an ssid stay empty. Can anyone tell me why? Any ...
0
votes
0answers
12 views

Caputing data from BluetoothLE sensors

I have been trying to grab data from BLE sensors using python. While the commandline tools worked flawlessly I couldn't get it to work with any other python framwork available for BLE. A collegue ...
1
vote
1answer
50 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
votes
1answer
52 views

Segmentation fault error. Trying to loop a python program [closed]

I'm using AT commands to send data over http, but the problem is that sometimes the program has an error and wont run again until I reboot and the GSM. Im using a crontab and also running the file as ...
1
vote
1answer
18 views

RC522 modules stop working when more than 2 are connected

So, here's a synopsis of what I am trying to do. I want to put 3 RC522 readers side by side inside of a book, facing the cover, that will be constantly on, using a Rpi zero W. When an RFID chip gets ...
2
votes
2answers
123 views

Python3.7 with Numpy on Raspbian

Goal: Install Python3.7 on the Raspberry Pi. Then install Numpy for Python3.7 Found this very useful Github Gist: https://gist.github.com/SeppPenner/6a5a30ebc8f79936fa136c524417761d Ran the ...
1
vote
3answers
926 views

Raspberry Pi won't recognize nRF24L01+

I'm a Raspberry Pi n00b and a python beginner, but I have a lot of experience with DIY electronics, arduino and c#. I've tried everything I can think of, and I just can't get the Pi to recognise the ...
-1
votes
2answers
201 views

Reverse DNS on internal LAN

Writing a Python program for my PiZeroW to scan and inventory my home local, internal network. I can easily iterate though the 256 internal DHCP available IP addresses (some assigned, some not), but ...
2
votes
1answer
58 views

Raspberry pi 3 RFID RC522 Card UID is not same with USB RFID Reader

I'm working with RFID RC522 using Raspberrypi 3B+. I'm following https://github.com/mxgxw/MFRC522-python this package and works like a charm. I can able to read the data from the card, able to write ...
0
votes
2answers
431 views

PyQt5 not found by Python3.7

I installed Python 3.7 on my raspberry pi with the help of Installing Python 3.7.0 on Raspbian tutorial and wanted to use it to start my script which uses PyQt5 but its throwing a ModuleNotFoundError. ...
1
vote
2answers
35 views

Can't exit my apllication in a clean way

Not sure if my problem is related to RaspberryPi, GPIO or just my understanding of Python but since I'm detecting my problem while playing with a button attached to my PI I ask it here. I have a ...
1
vote
3answers
100 views

How to stop LEDs blinking when button is pressed

I've got 4 LEDs, a buzzer and a button. There's an add_event_detect to switch the LEDs and buzzer on and off. The callback methods works find when the outputs are just on continuously until another ...
1
vote
2answers
270 views

Why does my raspberry pi zero w crashes when controlling a DC motor with an L9232D and a 9g Servo motor?

I use this simple circuit to control a DC motor with an L293D, and a 9g servo motor with a Raspberry PI Zero W: I use the simple following code to test the circuit: from time import sleep import RPi....
-1
votes
1answer
172 views

IR sensor program will not run

When I run it nothing happens either in command prompt or the shell. I think I am missing some code line but I got it from a online project and cant ferret out the problem This code is supposed to ...
1
vote
0answers
13 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: [...