Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

2
votes
1answer
52 views

Is there a way to enable VNC on my Pi with python?

I am creating a system and I want to make it as quick and painless to deploy as possible. I also need people who are unfamiliar with RPi to deploy it. So I am creating an installer that can handle ...
0
votes
1answer
103 views

How to ssh without needing a password [duplicate]

I just want to run a python file on raspberry pi and use terminal code ssh. So, I don't want type password to do that. What should I do?
0
votes
0answers
60 views

Error while upgrading about python unicornhat

I am having a problem while trying to upgrade my Raspberry Pi. It was a simple routine upgrade. I did update before upgrading. However, there seems to be an error while upgrading. The error is a ...
1
vote
0answers
41 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 ...
2
votes
2answers
54 views

SPI xfer2 callback possible?

I would like to control 10 different devices with SPI. As there is not enough ChipSelect outputs I use GPIO to toggle a MUX on the clock. Problem is I have to wait until the SPI is done transmitting ...
0
votes
2answers
118 views

How to run a python program from a bash script on startup?

I have a python script that is located at /etc/testscripts/WebServer. I call this usually from the command line by calling sudo python3.6 /etc/testscripts/WebServer. I have a bash script that looks ...
0
votes
0answers
27 views

collaborative music creation + online interpreter for sonic-pi

I would like to create an online interpreter that can be used to run sonic-pi. The goal of this being to allow people to collaboratively control the sandbox environment to create music with sonic-pi ...
1
vote
1answer
86 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 ...
0
votes
1answer
28 views

run an py file with systemd

i am trying to make the file to run on startup with rasbian STRETCH , the file need to be execute like this "configurator.py settings.conf" with this config it doesn't work [Service] Type=idle ...
1
vote
1answer
26 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
2answers
126 views

Why does my circuit keep burning out Raspberry Pi pins?

I have a reed switch (actually several reed switches) that came pre-installed in my home as alarm sensors. When the 2 parts are together, the circuit is closed, when the 2 parts are apart, the ...
0
votes
1answer
27 views

starting up radio and one led

I'm using this in as my /etc/init.d/pirateRadio.sh the Radio does play a wav with this in the rc.local export PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/sbin:/usr/bin sleep 10 ( exec &&...
0
votes
1answer
128 views

LED pwm fading is flickering

This is how I'm fading some LEDs using a logarithmic function. But with that the LEDs are flickering somehow. I don't understand why... import time import math import RPi.GPIO as GPIO GPIO.setmode(...
1
vote
1answer
122 views

How to read RAW Picamera jpeg images in python

I acquired a set of images with the command raspistill -r -ss 100000 -o image.jpg, and I'd like to process the 'JPEG+RAW' images, which I already obtained, with OpenCV on python. I am aware of ...
3
votes
1answer
161 views

Multiple /etc/rc.local?

I run a Python program in a screen session which is started from my /etc/rc.local with this command: su me -c "screen -d -m /usr/bin/python /mnt/usbdrive/pgms/mypgm.py" Recently my program has been ...
0
votes
1answer
46 views

pip install is giving weird errors on a RPI 3B+ with rasbian

If I try to install something using pip it gives me a weird error. Time is set correctly and sudo doesn't change anything. For example I try installing conan pip install conan​ gives an error: pi@...
0
votes
1answer
45 views

How to light up picamera LED without taking photo

I want to light up the picamera LED using python for a few seconds as a test to see if it works, without actually taking a photo. And yes I know I can test that by just taking a photo and watching it ...
0
votes
0answers
102 views

Remote debugging a python script fails

I am running into problems with remote debugging a Python script on a Raspberry Pi 2 Model B Version 1.1, where I followed the advices in this blog post. The script basically starts with import ...
1
vote
1answer
37 views

Picamera: set shutter_speed with RAW acquisition

I'm using a RPi zero W with a camera V2 to acquire RAW images (I used this). However, I would like to set the shutter speed; I used this to do that, but that doesn't work: import time import picamera ...
0
votes
1answer
171 views

using iso 15693 NFC tags on Raspberry with rc522

Is it possible to read/write ISO 15693 NFC tags using an RC522 chip? So far I do not have much experience with the chip, I downloaded this https://github.com/mxgxw/MFRC522-python library but ...
1
vote
2answers
91 views

Multithreading/infinite loops affecting sensor values

I run a Python script on my RPi that manages all the sensors on the board and communicates with another machine using TCP sockets. The project gained in complexity and my script now has 5 threads ...
1
vote
1answer
140 views

Trigger Python Script on Raspberry Pi from Windows

I have following situation (and problem): Setup: Raspberry Pi Zero W, connected to a Windows client via USB-OTG in Ethernet emulation mode. The Pi is controlling a single servo motor, via Python ...
1
vote
0answers
66 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 ...
0
votes
1answer
145 views

How to use an ultrasonic sensor with nanpy on Raspberry Pi?

I have been trying to run the following code on a Raspberry Pi, to use the ultrasonic sensor HC-SR04 with an Arduino that is a slave to a Raspberry Pi: from nanpy import ArduinoApi from nanpy import ...
0
votes
0answers
46 views

QT5 Stylesheets not working on Raspbian

I'm using QT5 and Python to make a GUI. I have this code: self.ui.btn_light_on.setStyleSheet('background-color: green') On Windows 10 and Ubuntu it colors the button green as needed. I want to use ...
0
votes
0answers
78 views

Running python in PHP shows error. -sudo: no tty present and no askpass program specified

I want to run a python script to turn an led on from PHP. The script did not run. I used echo to print the error. It said "sudo: no tty present and no askpass program specified". What should I do? ...
2
votes
3answers
118 views

Connecting multiple load cells Pi Zero W to read individual values

I have a project in mind where I want to measure the weight and position of an item on a shelf. The idea was to mount the shelf on a load cell in each end and then get the weight and ratio between ...
1
vote
2answers
249 views

open a terminal on boot and auto-run a looping python script

When my RPI3 is booted, I would like it to automatically have the terminal open with my python script already running. Note that it loops endlessly. I want to open the terminal so I check the output ...
1
vote
1answer
109 views

Python script not running when added to crontab

I have an on_reboot.sh file that contains the following: #!/bin/bash source /home/pi/.profile workon cv cd /home/pi/reboot python pi_test.py After that I made the file executable using $ chmod +x ...
1
vote
1answer
78 views

keep reading the same value from air pressure sensor (MS5611)

I have bought a GY-86 sensor. it is comprised of an accelerometer/gyroscope (Mpu6050) a magnetometer(HMC5883L) and a barometer(MS5611-01BA01). all these sensors have I2C interface. I am reading the ...
0
votes
1answer
223 views

serial errno 25 inappropriate ioctl for device

I have raspberry pi 3 B+ running latest raspbian-strech lite. i have a max485 ic connected to uart on the gpio. import serial,fcntl, struct ser = serial.Serial( port='/dev/serial0', ...
1
vote
0answers
208 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
148 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://...
0
votes
1answer
123 views

GPIO event handlers and inter-thread communication

I have a Python script using callback functions to react to GPIO events, as described here: https://sourceforge.net/p/raspberry-gpio-python/wiki/Inputs/ The description states that Python runs the ...
0
votes
0answers
48 views

Issue with running python script at start

Im currently running a python script at boot up using the rc.local method. it works great when i have my mouse, keyboard and monitor connected. However, the end goal of this project is to be able to ...
0
votes
1answer
165 views

Using the HMC5883L on the GY87

This was touched on in this question, but I was unable to get the solution to work: (Not all devices that are connection via I2C are showing) I have a GY-87 multi-sensor module and can get the IMU (...
0
votes
0answers
29 views

GPSD transfer timestamp

I am using gpsd on a raspberry pi connected to a serial GPS and transferring GPS fix to all other connected devices on the same network. Is there a way to transfer unix timestamp along with the GPS ...
0
votes
0answers
261 views

Problem with Pi Cam / Python / opencv: “Incorrect buffer length for resolution 640x480”

I want to build an animal counter based on pi zero w, pi cam, python and opencv. I read some tutorials (especially from https://www.pyimagesearch.com) how to setup all that stuff and in principle ...
0
votes
2answers
335 views

Host a website on the raspberry pi to display local sensor data [closed]

I have been enlisted by the local engineering club (as a programmer myself) to help with their hydroponics project. Basically they are needing help accessing the Pi remotely and this is as much as i ...
0
votes
2answers
51 views

How to make a service to run a python script which includes browser automation

I have python script which is using selenium web driver to do some web automation task. This python code is running perfectly fine when I am running it from the terminal. It launches firefox and does ...
0
votes
1answer
44 views

Rasp Pi, pip error setup.py egg_info

I am new to pi and I wanted to test it out on a python module for talking to building automation devices. Its called BAC0 From the documentation: https://bac0.readthedocs.io/en/latest/getstarted.html#...
1
vote
0answers
40 views

Raspberry pi controlled automated drone [closed]

I have to make an indoor drone(no GPS). The input to the drone will be the starting coordinates and the ending coordinates. I have an indoor map. How do I make this? The raspberry will be onboard the ...
0
votes
1answer
63 views

Executing multiple scripts on startup in a particular order

I am running Raspbian GNU Linux (9) Stretch, on my Raspberry Pi 3. Project Overview Python script which makes use of 2 inputs to the Pi. Calculations are performed based on these inputs, and values ...
0
votes
0answers
372 views

OpenCV : Gtk-WARNING **: cannot open display:

I got a python script supposed to load a video. My Pi set up in headless mode and I would like not to use any X server for displaying the video but instead having the video displayed to the hdmi port....
0
votes
2answers
57 views

Writing to GPS HAT on Raspberry Pi Zero W Never Returns Anything

I have attached a GPS HAT to a Raspberry Pi Zero W running RASPBIAN STRETCH WITH DESKTOP. When I SSH in to run a simple Python script that writes to the HAT serial port, nothing happens and I am not ...
1
vote
1answer
152 views

luma.core.error.DeviceNotFoundError: SPI device not found

I'm trying to setting up my new Dot Matrix MCU LED Display Module 8x32 with MAX7219 on my Raspberry Pi 3. I followed all the steps here https://max7219.readthedocs.io/en/0.2.3/ and of course using ...
0
votes
1answer
145 views

feh can't display image

I have written a python script that displays the image from the URL. def image_func(link_image): img_cmd = "feh -F %s" %(link_image) os.system(img_cmd) os.system("pkill feh") If I ...
-2
votes
1answer
155 views

How can I setup i2c on Alpine Linux? [closed]

There are tutorials all over the internet about how to enable i2c on Rasbian using raspi-config, but I'd like to work with Alpine Linux. How do the i2c devices/drivers/kernel modules work and how can ...
0
votes
1answer
23 views

SSH showing “connection failed” after installing “pip”

Python3, pip3 and python was installed before on my Raspberry Pi. Today I've successfully installed pip using below command: sudo apt-get install python-pip After few hours later I'm not able to ...
2
votes
2answers
71 views

why GPIO.LOW is used to turn the switch on?

I am learning raspberry pi and somewhere i found the tutorial of turning the bulb on when clap is heard and off the bulb when clapped again. The following code was written for this to work #!/usr/bin/...