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.

0
votes
3answers
50 views

Raspberry Pi Random Turns Off

So, I was doing a project with PWM (Pulse-width modulation) but something unsual happens, my raspberry pi turns off. I am using a RPi model 2B, and my circuit looks as follows simulate this circuit &...
0
votes
0answers
56 views

Does anyone know how to simulate keystrokes on a raspberry pi with code?

I would like to replicate this code, but on a raspberry pi. It imports for windows. Does anyone know of a library or anything that could help? https://stackoverflow.com/questions/13564851/how-to-...
2
votes
2answers
108 views

Excute python file on start-up

I have a simple python file(no GUI) that I'd like it to run in the background at start-up of raspberry pi 3b. I checked out this post Execute script on start-up But it didn't specify what to do with ...
0
votes
1answer
43 views

How to I check and confirm if one's Pi 3's “Raspbian kernel” supports I2C on additional GPIO pins?

The June 4, 2018 Instructables article Raspberry Pi Multiple I2C Devices by Jacco Slabbert says The latest raspbian kernel support the creation of multiple I2C busses using GPIO pins. See also in ...
0
votes
0answers
28 views

Using Barcodes as ID cards

I am thinking of using a barcode reader with barcodes on cards of paper to use as ID cards. The barcodes will be read using the raspberry pi's camera with some image processing software (using the ...
0
votes
0answers
38 views

finish overlay Python

Hello, How can I stop a Picamera Overlay? My code is "this start the camera with the ovelay" def capture(self): print("Capture") camera.start_preview() img = Image.open('test.png') ...
1
vote
1answer
1k views

“ImportError: No module named 'gspread'”

I installed gspread library and ran pip install gspread and followed all the instructions on this page. I've read many other threads on this issue and have checked that no file named gspread.py exists ...
0
votes
1answer
86 views

HC-08 - RPI 3 - Can read but can't write

I use a Raspberry Pi 3 Model B and I have a Bluetooth HC-08 module. I would like to be able to send and receive data. I use the port /dev/ttyS0 and I changed the file /boot/config.txt for "...
0
votes
0answers
16 views

Problem after updating opencv

I am using raspberry pi 3 jessian I tried to update my opencv using Sudo pip install opencv-contrib -python Now i cant import cv2 in any program . Thanks in advance for any help. I am really in ...
-3
votes
1answer
1k views

Which is the standard python library for Rpi other than GPIO library? [closed]

Which python library is best one to use for programming RPI? I want to program RPI zero and Rpi 3 model B+ using python. I know that there is a GPIO library available for RPI. However, in its readme ...
0
votes
0answers
155 views

Emulating a Pi Camera (CSI) device? It is possible?

I need to run a Python script that uses the Pi Camera Module (python) inside of a Raspberry Pi 3 but I don't have a Pi Camera (CSI) device yet (only a USB webcam). It is possible to emulate a Pi ...
0
votes
1answer
27 views

Passing data from output of a function to be used in a function python

I have a few parts of a weather station together and am running into an issue with functions. the humair fuction returns two values hum and airtemp. The problem is when the sendpost function runs it ...
0
votes
0answers
199 views

How can I place a PiCamera stream inside a PyQt5 GUI?

I have a camera connected to a Raspberry Pi but am unable to find anything about placing the PiCamera stream inside a GUI constructed with PyQt5. Most tutorials I've found online place an OpenCV ...
-1
votes
1answer
33 views

Connecting to the Python server script on the Raspberry Pi over the internet

My application is simple, I want to create a Python server script on my Raspberry Pi and should be able to send a message to my server from internet. My end goal is to control the Raspberry Pi GPIO ...
0
votes
0answers
49 views

Pi stuck on reboot

I have a Raspberry Pi that is stuck on reboot. I wish to use the Pi to send a CEC command to a television to turn it on or off over the HDMI connection. I have it run the following python script at ...
0
votes
0answers
497 views

Raspberry pi 3b+ with Python wifi library

Please has anyone has any luck using the python wifi library in a python script to setup wifi on the raspberry pi 3b+? I have been trying for a long time now, but no luck. I have configured wifi ...
0
votes
1answer
828 views

Toggle state to trigger a function with a button in Python - loops on and off and need help [closed]

I’m trying to use a button, in this case an Amazon Dash Button, to trigger two functions - i.e. push once it activates one function, push again activates another. I have tried setting a state to the ...
0
votes
1answer
62 views

RPi, php, python and string lengths

Are there limitations on the length of strings passed to php by python in a service? I had a php service running that retrieved data from a python script. Worked well. I decided to add data from ...
1
vote
5answers
2k views

How to directly get CPU temp in Python?

Goal is to switch an exhaust fan at an outside data-logging station at a solar power station. The data-collection program is written in Python under Raspbian. For reading CPU temp at a command line, ...
1
vote
2answers
175 views

Take stills with Picamera() with auto exposure without enabling camera.start_preview()

following this tutorial on https://projects.raspberrypi.org/en/projects/getting-started-with-picamera/6 , I am told that I need to use camera.start_preview() and sleep(5) in order to turn on auto ...
-2
votes
1answer
205 views

How to upload data from raspberry pi to MySQL, geting errors [closed]

Basically I am trying to upload the data collected from my raspberry pi to MySQL, I have a table called DHT_data with columns 'datetime' using data type timestamp, 'temp' using data type numeric, 'hum'...
0
votes
0answers
117 views

Raspberry Pi goes black on launching kivy application

After installing kivy on my raspberry pi model 3 b+ i tried to launch a simple kivy application. When launched the application just goes black instead of showing the buttons. import kivy from kivy....
0
votes
0answers
539 views

Reading data from MCP3551 via SPI

I am trying to read data via SPI from an ozone sensor that I have connected to the Raspberry Pi's GPIO. This set up uses a Mikro Pi click shield and Mikro Ozone 2 click sensor. The output of the ...
1
vote
2answers
1k views

Accessing EXPORTED Environment Variables in Python

An often asked question, I know, but after searching through other solutions I'm still having problems. Most solutions say to make sure your variables are exported before trying to access them, but ...
0
votes
0answers
56 views

Deploying Python code from NetBeans IDE to Raspberry Pi [duplicate]

I have a Raspberry Pi 3 Model B+ and I am using NetBeans 8.1 on Windows 10 PC. How can I run/deploy a python code which I have written in NetBeans to my Pi for testing?
0
votes
1answer
195 views

Python Adafruit DHT11 error

I have a very simple Python program on my RPi0W to display DHT11 Temp and Pressure readings using SSH. I'm planning to build on it to develop a data logger using MySql. I tested the program and it ...
1
vote
1answer
108 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....
0
votes
1answer
161 views

pigpio spi : use an other GPIO for chip select

I'm using the Waveshare High-Precision AD/DA Board, and they not use the default chip select pin of RPi (GPIO# 7, 8) for SPI. Using the pigpio python library, I want to know how to change the chip ...
0
votes
0answers
110 views

Run rpi_ws281x without sudo

I compiled the rpi_ws281x Library and the neopixel python wrapper following the instructions on https://learn.adafruit.com/neopixels-on-raspberry-pi/software The strandtest.py works using PWM on ...
0
votes
0answers
94 views

Raspberry Pi freezes occasionally after weeks

i've got a RPI 3 Model B (Linux raspberrypi 4.9.80-v7+ #1098 SMP Fri Mar 9 19:11:42 GMT 2018 armv7l GNU/Linux), that runs 24/7. Its sole purpose is to write data to a SQL database in a python program. ...
1
vote
1answer
427 views

Python Script with Systemctl not working only on Stretch

I've been using systemctl to manage multiple python scripts on raspberry pi 3b running jessie for a while. I recently got a rpi 3b+ and installed the lates Stretch on it. Set up the exact same way as ...
1
vote
0answers
33 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 ...
0
votes
2answers
78 views

I2C Primitive Sunfction for Python & Pi

Well-versed in C/C++, but new to Python. I have done a lot of research here and maybe I am missing something, but it seems that Pi/Python does not have primitive functions for I2C, which is sad to ...
0
votes
0answers
204 views

DHT22 Sensor not working

I'm using a Pi 3 running Raspbian with a DHT22 sensor. When I run the DHT22 code: import Adafruit_DHT from time import sleep DELAY_INTERVAL = 0.3 dht_sensor = Adafruit_DHT.DHT22 DHT_PIN = 4 while ...
1
vote
2answers
2k views

Run python script at startup with Systemd service

I am having troubles running a python server script at startup on my RPi 3 B+. I created a python file and placed it in /home/pi/Desktop/scripts/bulb.py, it contains the python interpreter should be ...
0
votes
0answers
73 views

AMS Franklin AS3935 Lightning Sensor can't detect linghtning

I'm using Embedded Adventures MOD-1016 with AMS Franklin AS3935 connected by I2C. The code is from pcfens/RaspberryPi-AS3935 as in given there example. Everything looks OK. No bugs, noises and ...
1
vote
3answers
385 views

How to build a raspberry devices monitoring center

I have multiple devices of Raspberry and i'm trying to create a page to monitor these devices, something like an IoT platform but much simpler. so basically a page with a username and a password and ...
0
votes
2answers
936 views

import cv2 not working Raspberry Pi

I used pip to install opencv3 with the following command on an Anaconda virtual environment. install opencv-python I successfully installed it because I can see the package in pip list. (olfatf)...
0
votes
0answers
37 views

HTTPServer / FTPServer loop colliding with callback thread

I am building an alarm application. I have a few PIR sensors and webcams. The application contains a webserver I use to manage the alarm from a mobile application done with kivy.The webcams upload ...
-1
votes
1answer
327 views

How to remove the kill prompt of a python script?

I have a python script that uses Tkinter, the quit button I have implemented pops up a prompt on the python shell after pressing it, which it didn't do on Windows when I wrote the code and tested it. ...
0
votes
1answer
163 views

NameError: name 'lt' is not defined when running GPS Python script [closed]

Traceback (most recent call last): File "/home/pi/gps.py", line 18, in <module> while cd &lt>= 50: NameError: name 'lt' is not defined It is showing like this when I run the ...
1
vote
2answers
151 views

What's wrong with this little python script?

I followed this tutorial to log my CPU temperature into a .csv-file and try to run the .py script it at bootup with cron. The script: from gpiozero import CPUTemperature from time import sleep, ...
1
vote
2answers
77 views

Rpi3 log file opened and closed with python but corrupted on power loss - albeit file was closed

I have to ensure that every minute I open, write, and close a log file. It must be closed as we trigger power loss randomly on the Rpi3. I known it is bad and I also know that you want to use ...
1
vote
1answer
711 views

segmentation fault python

I was trying to install the opencv with TBB in a new virtual environment. So I have two virtual environments and a base environment. Before this compiling, the base environment was working well, with ...
0
votes
2answers
364 views

How can I wait for two presses of the button then run function in while loop

I am trying to compute the difference between two images with OpenCV on Raspberry Pi and I want the script to run continually like in a while loop and then after the first button press store the first ...
0
votes
0answers
192 views

PyAudio callback method producing clicking, depends on bitrate?

I am having a lot of trouble getting PyAudio callback method to produce uninterrupted sound. I am generating data to play using keyboard clicks set to different notes. Whenever I run the file I get ...
2
votes
1answer
132 views

Is it possible to send 'left arrow' to the OMXPlayer console?

I'm building a MP3 player with physical buttons using a Raspberry Pi and Python. I'm using the subprocess library to allow simultaneous actions without blocking user input. I'm sending commands to ...
1
vote
1answer
84 views

Socket code for python 3.6.5

After discussions, It became apparent that the I2C might not be great for data transfer (as it freezes up the Arduino to perform the transfer. So I'm sticking with the socket code. Question now is how ...
0
votes
2answers
1k views

Problem on installing Pyaudio on Raspberry Pi

I was trying to install pyaudio following the steps: 1) sudo apt-get install python-dev 2) sudo apt-get install portaudio19-dev 3) sudo pip install pyaudio Couldn't get through step 2. Error ...
0
votes
0answers
365 views

Raspberry pi 3 B connection with wireless IP camera through RTSP (Wifi)

i'm using python=3.5 and OpenCV 3.1.4 to establish a connection with my IP camera via RTSP protocol and by using wifi on Raspberry Pi 3 B here's my code import cv2 from imutils.video import ...