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.

641 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1
vote
0answers
234 views

How can I pause video of omxplayer using python script?

I am using omxplayer to play videos. The video played very well. But I can't pause the video using the commands below. Can any one help me how to pause my video using python script? Here, is the ...
1
vote
2answers
57 views

How to use Config file between multiple pis

I have multiple pi's running a program where they listen for a broadcast message and trigger a python script. My python script that's triggered has config details that is same for all pi's. Whenever ...
1
vote
0answers
106 views

Rasperry, flask and missing libraries

I have installed Apache2 on the Raspberry and the idea is to run a Flask app. I managed to write a very simple app: import requests from flask import Flask from flask import make_response from flask ...
1
vote
1answer
326 views

Fade screen on sleep and brighten on wake

I'm looking for a way to control the screen brightness from code. I saw this post but this just turns the screen on and off. How can I dim the screen before it goes to sleep instead of just turning it ...
1
vote
1answer
172 views

python pointing to wrong ssl version

For a project i need to be using ssl 1.0.2. For some reason though python seems to be pointing to a wrong version. i have installed pip pyOpenSSL and upgraded libssl-dev and python3-openssl, but ...
1
vote
0answers
121 views

Having trouble on one of the raspi official projects “getting started with GUIs”

I have raspi 3, and working on "Getting started with GUIs". I am currently on this page (https://projects.raspberrypi.org/en/projects/getting-started-with-guis/11) and having trouble at the line ...
1
vote
0answers
822 views

RPi.GPIO - Properly Wiring and Setting Up Pins for Button Inputs

Edit: Breadboard, schematic, and code updated. I accidentally fried my Pi by shorting it out through the GPIO pins, so I figured it would be a good idea to ask for some help before trying my current ...
1
vote
0answers
301 views

Python HID API's for RPi's

I realize that solutions exist for having an RPi emulate an HID device (Can the Pi Emulate an HID device with via USB?) but are there any existing API's that can achieve the same thing as https://...
1
vote
0answers
27 views

How to create installer files in Raspberry pi

I have created a program in Raspberry pi and I am running it using the command python myprogram.py . Is it possible to create the installer file of this program? that means after installing this ...
1
vote
2answers
308 views

Can't blink a LED using SPI interface on Raspberry Pi v3

As a part of my PoC project, I'm using single 5050 LED made by Adafruit. I wired it like this (LED - RPi): DI (Data Input) - SPI0 MOSI CI (Clock Input) - SPI0 SCLK GND (Ground) - GND VCC (5V) - 5V ...
1
vote
0answers
258 views

Send data BMP180 between client and server trought module socket

I would like to send data of BMP180 sensor between a client and a server with two raspberry pi 3 being that the client when executing the command get the server will give the temperature value to the ...
1
vote
1answer
260 views

GPIO Input Not Detected Within While Loop

Hi I'm having a problem with trying to detect GPIO input on a PIN within a while loop. Turnstile B Entry button is what I am troubleshooting the statement if tsB_entry_button == False: import RPi....
1
vote
0answers
39 views

Unwanted calls of program with GPIO

I configured a Raspberry Pi 2 with a button. I have a script in python, which will call a command, if someone press the button. The command doing a sip phone call to a phone server (cisco ...
1
vote
0answers
284 views

Displaying only video/image while python program running on background

I have a Raspberry Pi 3B with a Python3 code running 24/7. Right now, I'm running Raspbian Stretch desktop on console mode with no I/O. I only connect a screen via HDMI and an USB keyboard for ...
1
vote
2answers
1k views

Raspberry pi 3 reading serial port

I have a python code that reads the serial port of the raspberry pi 3to obtain GPS positions from a fona808. The code works for some time and then throws this error. Traceback (most recent call last):...
1
vote
0answers
866 views

How to detect audio sounds with Raspberry Pi 3 using Python?

I'm creating a voice recognition system using Raspberry Pi 3 using Python and taking inputs (voice commands and audio sounds) through a microphone. I have been able to get voice input using the ...
1
vote
0answers
189 views

Simultaneous sampling using ADC and displaying in graphical LCD

I am using Raspberry Pi 3 Model B and MCP3008 for sampling my analog signal and the sampling frequeny is approximately 10 kHz. I need to display the sampled values in 3.5' inch graphical LCD. I just ...
1
vote
1answer
2k views

RFID RC522 Reader & Chromium Web Page

I'm having a bit of difficulty locating a specific example, however I have found people referencing that they have accomplished what I am looking for. At a basic level, I have a webpage being served ...
1
vote
0answers
2k views

How do I test if my UART port is working? Simple example… loopback-test

I am working on a NMEA(GPS)-datalogger for a drone. I followed the tutorial from fishandwhistle and createt this script: #!/usr/bin/python3 import os, time, sys, glob, datetime, syslog, pynmea2, ...
1
vote
0answers
41 views

In the Google AIY for Pi project make google_auth_authlib.flow visible to Python 3

The Google AIY project for Raspberry Pi works great out of the box. When trying to use their libraries, scripts and code templates in a custom project, however, I hit a bump. My project has the same/...
1
vote
0answers
379 views

Redirect a USB Keyboard to Stdin

I am wanting to run a Python script that constantly loops for input on a keyboard (its actually and RFID HID). The script will be run on startup, but the Raspberry Pi will be headless. How can I ...
1
vote
0answers
738 views

PyQt support for WebEngine on raspberry Pi 3 raspbian-stretch

I have installed PyQt5 for Python3. However while I can import various modules into Python I am finding that none of the WebEngine modules import (WebEngine, WebEngineWidgets, WebEngineCore). They ...
1
vote
0answers
430 views

MIDI out over USB

I'm trying to build a MIDI controller using a Raspberry Pi Zero. I have all the hardware and code to process the (analog) input signals, but I can't figure out how to send the MIDI data over USB. I ...
1
vote
0answers
83 views

Raspberry Pi bluetooth connects but gives me this error when I try to run a script

My question is about the raspberry pi original and raspberry pi 3 connect to the android's Bluetooth beautifully according to both the phone and pi. However, when I try to run a file I get the ...
1
vote
1answer
3k 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 ...
1
vote
0answers
167 views

Raspberry pi shutdown when running python code

i have a python code which is running and has no errors, it is connected with arduino uno using nanpy firmware and lcd which has the library of adafruit/Adafruit_Python_CharLCD and it uses gpio BCM, ...
1
vote
1answer
498 views

Bluetoothctl connect TIMEOUT exception

This is the error I am getting when I connect to my mobile phone using the connect method in this documentation: https://gist.github.com/egorf/66d88056a9d703928f93, raise TIMEOUT(msg) pexpect....
1
vote
0answers
319 views

Raspberry Pi won't send data through serial port

I have simple app in python that should send data through serial port (serial0/ttyS0): import RPi.GPIO as io import time import serial import array io.setmode(io.BCM) ser = serial.Serial(port="/dev/...
1
vote
0answers
496 views

Python Speech Recognition not detecting audio in script - Audio is detected in audacity and bash

I am trying to get python speech recognition (PSR) for a basic Pi project. I am using: OS: PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)" NAME="Raspbian GNU/Linux" VERSION_ID="9" VERSION="9 (stretch)"...
1
vote
0answers
1k views

Very slow serial port reading

I have the following code, used on an RPi2: import serial import time # Set up serial port ser = serial.Serial( port='/dev/ttyAMA0', baudrate=921600, parity=serial.PARITY_NONE, ...
1
vote
0answers
46 views

Using RPi as DAQ for PC

I am quite new to using RPi, but my experience has been great so far. I am hoping to achieve just one more thing. I have 4 ADCs hooked up to my RPi using I2C, and I am sampling at roughly 800 - 1000 ...
1
vote
0answers
601 views

OpenCV and PiCamera problem

I want to get photo from raspberry pi camera in python and i tried this code and it's works for me: for filename in camera.capture_continuous('img.jpg'): test_img = cv2.imread('img.jpg') But ...
1
vote
1answer
247 views

reverse-geocoder on Raspberry Pi

In a project I am currently working on, I use Python to display my current location, speed, etc. I now wanted to implement the reverse_geocoder library (https://github.com/thampiman/reverse-geocoder) ...
1
vote
0answers
294 views

How to make omxplayer not always on top?

I am using Adafruit's Video Looper to loop on a video using python script and omxplayer. Although, I made a few modifications. I want a popup window to appear when a GPIO button is pressed. I have ...
1
vote
0answers
224 views

arecord through subprocess works randomly in raspberry pi,how to solve?

I am using arecord through subprocess to record in raspberry pi : press joystick button to start recording and press button again to stop recording, It works randomly: when I press the button, the ...
1
vote
0answers
141 views

Attribute Error for Adafruit SSD 1306

When I try and run code that uses AdafruitSSD1306, it gives an attribute error that looks like this: Here is my code, #!/usr/bin/env python import time import Adafruit_SSD1306 import RPi.GPIO as ...
1
vote
0answers
239 views

Launch Kivy applications on RPi in framebuffer mode

I've been trying to make Kivy work on my RPi. I was told kivy files cannot be launched over SSH and hence I get x-window errors. I've tried launching the main.py of my test application in VNC, with ...
1
vote
0answers
723 views

How does one use the SPIDev xfer command?

I can't figure out what the input/output of the SPIDev xfer command is supposed to be. I know it accepts an array of integers but what does it mean? I initially thought it meant the byte array of an ...
1
vote
0answers
671 views

Problems with PyQt5

Quoting: I developed a similar application using PyQt4 and Qt4-designer. You have to install pyqt4 all modules: sudo apt-get install qt4-default qt4-designer qt4-doc qt4-dev-tools python-...
1
vote
0answers
661 views

Slow I2C Communication using SMBUS

I'm trying to detect air bubbles in water pipes and want to use an FDC2114 Capacitive Sensor. For my project I need to get at least 6000 SPS out of the FDC. I tried to use an Arduino Mini Pro 3,3V as ...
1
vote
0answers
180 views

Unable to start capture: Invalid argument

Below code all are work well but when I add a code publish the live stream through dataplicity. There will occur error "Unable to start capture: Invalid argument i: Error grabbing frames". After the ...
1
vote
0answers
438 views

Sockets stopped working

I have set up a home automation using a raspberry pi b+ V3 as the brains main part and raspberry pi zero's located around the house at different points. I have one pi zero beside my heating, this is ...
1
vote
1answer
149 views

Start pi_video_looper from Python

I am new to Python so please be kind ;) I am trying to start the Adafruit Video Looper from a python script. Basically I have this code: from pi_video_looper.Adafruit_Video_Looper.video_looper ...
1
vote
0answers
46 views

The Python Games that come with NOOBS extend off screen

Most (all?) Python games that come with NOOBS (Pentamino, GemGem etc) extend off the bottom of my Raspberry Pi 7-inch touch screen. I can successfully play some of them by right clicking the TLH ...
1
vote
2answers
520 views

mq5 gas sensor not alerting of leakages

I'm currently using an mq5 gas sensor in my kitchen with the MCP3208 ADC. my code shows a continuous loop of the voltage charge. in the mq5 as it detects gases in the air. It is supposed to print ("...
1
vote
0answers
76 views

PuTTY network error when running Python scripts on a Raspberry Pi

I run Python scripts on my Raspberry Pi from my Android device and it always works for 3 or 4 times, but when I do it more, PuTTY tells me the following: Network error: Software caused connection ...
1
vote
0answers
209 views

Cursor doesn't respond to touch in pyqt5 program

I am very new to both programming in python and touch interface stuff on the Pi. I have run into an issue I can't seem to resolve by googling: I have a Sainsmart 7" touch screen that works perfectly ...
1
vote
1answer
4k views

Error trying to install python-firebase on Raspberry Pi 3

I have installed requests but I'm unable to install the python-firebase package. I want to fetch data from firebase on my Raspberry Pi 3. I have used the following code to do the same on my PC. from ...
1
vote
1answer
285 views

Installing Jasper runs on several errors

I'm trying to install Jasper with this guide. Now i'm hanging with the following problem: i try to use the command sudo apt-get -t experimental install phonetisaurus m2m-aligner mitlm libfst-tools, ...
1
vote
1answer
251 views

Asterisk and Python communicate in Raspberry Pi?

I'm currently working on a project which is based on RPi and Asterisk. What I Want In my project, I need to get incoming call details like caller ID into python and perform some functions connected ...