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
170 views

Scientific Python 3 Updates

I want to use python 3 with the many scientific updates (numpy, etc.) on my new Raspberry Pi 3 (with latest Raspian). I followed some excellent advice from: Scientific Python for Raspberry Pi ...
1
vote
0answers
2k views

Raspberry Pi, Python and snmp traps, tripping a light when a network drop disconnects

I've got a fun little problem that I have hacked together a solution for, but I'm thinking there's probably a more elegant way of going about it. (I also had one heck of a time googling any ...
1
vote
0answers
532 views

Raspberry Pi 3 16x2 LCD display issue

I am trying to run code to output to my 16x2 display, but when I try to run the python file, there is no visible output to the display, and the following is returned: "/usr/local/lib/python2.7/dist-...
1
vote
1answer
3k views

Execute python script with web server apache2

I have a problem, I can't execute a Python script on my Raspberry Pi 3. I set an Apache server to execute a python script by following a tutorial. I can execute the following script: #!/usr/bin/...
1
vote
0answers
257 views

subprocess stdout into a variable for Ngrok

I'm trying to make a python script wich reports me the port on 0.tcp.ngrok.io is started when I run the code on terminal (after moving ngrok executable file to /usr/local/bin) ngrok tcp 22 I get ths ...
1
vote
0answers
153 views

Python Google drive upload not working continuously

I am trying to build an auto image Google drive up-loader with raspberry pi and a web-cam but the python script I wrote after executing once properly doesn't seem to work if I execute it again ...
1
vote
1answer
89 views

Cannot Load Library “./pxcore.so” to autorun a python script on boot using systemd

I want to run a code at startup but I am getting this error below. The script works when running in python, but I am unsure how to allocate permissions or where to make a path to the pxcore.so file so ...
1
vote
0answers
575 views

Remote python debugging with Visual Studio Code from Mac

I am trying to remote debug from Visual Studio Code on Mac OS. I would like to know if anyone has managed this or if it only possible from Visual Studio for Windows, or if not, what am I doing wrong? ...
1
vote
1answer
1k views

Problem with GPS module and Python

I copied a program from the Adafruit webpage to test my GPS module and before running it I installed the Python gps with sudo apt-get install python-gps but when I run the program I get this error: ...
1
vote
0answers
949 views

Problems communicating with USB to Serial CP210x Rs-485 serial device not responding

I have a hardware setup with one lock controller Made in China, I have setted up everything as it was supposed to, trying to communicate with the device with Python Script, lsusb show me the device ...
1
vote
0answers
150 views

Trouble with sound detection

I am trying to see how long it takes pygame.mixer.music.play() to actually initialize a sound. I have an audio cord running out the 3.5 jack back into the Pi through a USB soundcard. I think the code ...
1
vote
0answers
81 views

Opening and closing of gate based on value returned by a function in Python

I was writing a piece of code to open/close a gate, based on the value returned by a function. The gate is linked to an Arduino and a Python program. When I run the function blinktheLED, it will print ...
1
vote
0answers
4k views

Read Qr-Code from Raspberry Pi Camera in Browser with Flask

Im stuck with implementing a Qr-Code Scanner I found here: https://stackoverflow.com/questions/23538522/scanning-qr-code-via-zbar-and-raspicam-modul I already managed to set up the Raspberry Pi ...
1
vote
0answers
562 views

Sense Hat import error

I made a python program for my Raspberry Pi a while back and it uses my sense hat and motion sensor both connect via gpio by using a TriGpio expansion board and it worked for a while until recently ...
1
vote
3answers
724 views

Crontab task not running script - Permissions?

I've got a python script on my Pi 3 to read a value from an ultra-sonic sensor then write to a db - that alls grand. I've tried to make a crontab task scheduler for it, but it's not working. First, ...
1
vote
0answers
7k views

Connecting a bluetooth device in python using pybluez

wondering if anyone can help me with this. I'm very new to programming in general and am struggling getting my head around bluetooth. I have been trying to follow the examples given at http://people....
1
vote
0answers
150 views

Issue calling commands behind Tkinter

I'm trying to get an audio playback system on a Raspberry Pi to play back a selected sample in Python when the GPIO detects an input from an Arduino, (stepped down to 3.3V). Here a simplified section ...
1
vote
0answers
562 views

Cannot install pip3.5. Pip is configured with locations that require TSL/SSL?

I'm trying to install pip3.5 with python3.5 on raspbian on my raspberry pi, and I can not get it to work for the life of me. I have already installed python 3.5 without problems but I cannot seem to ...
1
vote
1answer
1k views

Kivy on Raspberry Pi: Mouse cursor not showing

I'm running kivy on a Raspberry Pi. I accepted that apparently you can't get around the fullscreen, but I can't get the cursor to show either. I tried by adding touchring = show_cursor=true to the [...
1
vote
0answers
449 views

Audio Issue with Multiple USB Sound Cards

I'm trying to build a simple python program that will capture audio from 2 different audio inputs and then play audio from 1 of them. I bought 2 USB sound cards so I could do this. I started with an ...
1
vote
1answer
393 views

Python's raw_input() function causes problems in systemctl service

I am attempting to create a safe reset switch according to these instructions. I have implemented the interrupt-based solution (listing 1) which runs fine if I start the script from the command line, ...
1
vote
1answer
178 views

Python Code for Home Automation times out

I was making a python script for home automation using Adafruit IO as a conduit between IFTTT and the Raspi, and it works great for a while. But after a few hours, it just stops working. I have no ...
1
vote
0answers
942 views

White Balance Drift off from Pi Camera

I'm currently trying to develop image tracking using color in Python 3 and OpenCV. But i am facing problem in PiCamera. At the moment, i've done some method to fix white balance, shutter speed, and ...
1
vote
0answers
329 views

How do I save an image via imgproc? [Raspberry Pi]

I am creating a project with python and Raspberry Pi. I am trying to use my Webcam, as I, unfortunately burned my Camera Module. I was following along: https://www.cl.cam.ac.uk/projects/raspberrypi/...
1
vote
1answer
279 views

Parallax RFID Serial Not reading tags

I am a complete newbie with Raspberry Pi and any type of hardware prototyping. I have been trying to get a Parallax RFID working with my Pi 3. I currently have it wired to the GPIO using BCM and the ...
1
vote
1answer
5k views

Selenium - Firefox - OSError: [Errno 8] Exec format error

I'm trying to run selenium on a Raspberry Pi 3. I've installed geckodriver and added it to my path. $: which geckodriver /bin/geckodriver echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/...
1
vote
0answers
875 views

VLC Python bindings don't work on PiZero with Justboom DAC Zero

I am trying to setup an audio player in Python using vlc.py bindings, but the simplest of code seems to throw an error. I want it running headless so I am trying all my experiments over SSH. Code ...
1
vote
1answer
1k views

“404 not found” error when requesting Python with Lighttpd through CGI

I've installed lighttpd and gotten it to serve /var/www/index.html just fine, but I haven't gotten it to run a Python script yet. I enabled CGI and set it's match case and directory as instructed in ...
1
vote
0answers
326 views

Python GPIO Script does not work in background

I have written a script to open/close my roller shutter using two buttons and a relay. One button to open, one button to close. Here is my script : import RPi.GPIO as GPIO import time relay_pin = ...
1
vote
0answers
633 views

Can't connect to my Raspberry Pi 3 with a socket

I want to use my Raspberry Pi 3 as a server so I want to connect it via a socket. At first time everything was fine but now I cant connect any more. I get this error: ConnectionRefusedError: [...
1
vote
0answers
681 views

Raspberry 3, python and shared libraries

I want to code something which can remote this robot: Dobot Magician http://dobot.cc/dobot-magician/product-overview.html. I have a Raspberry 3 and I downloaded the precompiled DLL for Linux on Dobot'...
1
vote
0answers
606 views

Pyserial code hangs after a while

I have some code that parses serial data into chunks for Kivy to read. For some reason the code will work perfectly for a while and then stop. I think I need to clear the buffer/memory somewhere but ...
1
vote
0answers
1k views

i2c requires restart before bus access

I have a Pi3 running Jesse and I am running some standard Python scripts to access the i2c bus to read voltage from an ADS1115. After a reboot I have found I need to run the following to allow the ...
1
vote
0answers
581 views

GPIO PCM on RPi 3 B model

I have a decoder from a PCM system. I want to stream digital sound by the PCM pins of my RPi using the CLK, FS, and digital output to complete my PCM system. I have been looking for information, but ...
1
vote
0answers
271 views

Log Raspberry pi time according to GPU (i.e. using real time OS)

Using the below given script, I am able to log camera.timestamp and camera.frame.timestamp. These should ideally be same as they both query GPU System clock time. For example, for 30hz frame-rate, ...
1
vote
0answers
1k views

how to close fswebcam after using it in python

I used fswebcam in python together with os.system() but i do not know how to close it after using it is in a loop that is why I want to close it like the picamera.close()
1
vote
0answers
341 views

Change pip from 3.4 to 3.5

Recently, I have installed python3.5 on raspi, while I had 3.4 (by default). So now I have a problem with pip, because it is linked with 3.4 and not 3.5, so whenever I install package, it is done for ...
1
vote
0answers
1k views

How do I release or free /dev/ttyUSB0?

I am trying to work with raw GPS data from a USB GPS receiver (Delorme LT-20) through /dev/ttyUSB0/. My program had been working, but today I get this error: could not open port /dev/ttyUSB0: [...
1
vote
0answers
404 views

Trouble with Python script from rc.local (TTY issue?)

I have not been able to find a solution to an issue affecting one of my Python programs only when it runs from rc.local. Update added to the end with additional information. A brief description of ...
1
vote
0answers
1k views

How can I use an already installed module when I'm using a virtual environment?

I have created a virtual enviroment on my RPI3 (Raspbian-Jessie), so that I may more easily work with a particular image-searching software (as outlined in this tutorial, step #4). My script requires ...
1
vote
0answers
954 views

How to Tell if Too Many Threads Are Crashing My Multithreaded Python Program?

How can I tell if my multithreaded Python program is crashing on my Pi 3 because there are too many threads? (Or poorly written ones?) My multithreaded program involves three looping threads: a main ...
1
vote
1answer
782 views

Listening to GPIB Bus Communication - Raspberry Pi

I am making use of Prologix GPIB-USB Controller to be used in LISTEN ONLY mode (Device Mode) to decipher data communication between Two instruments namely Tester & Prober. I have written a sample ...
1
vote
0answers
969 views

Python controlling OMXPlayer, DVI and HDMI causes issues in sub process

I hope anyone can help. I have built a Python script that uses a triggering action to start playing a video of a door opening. When triggered, it should start playing the video of a door opening, and ...
1
vote
0answers
295 views

Optical mouse camera conect to RPi3 via serial port

I try to read the optical mouse sensor IC in the RPi3 via the serial port. The idea is base on this tutorial but in my case I have the ADNS-5020 sensor. I set enable_uart=1 in /boot/config.txt and I ...
1
vote
0answers
26 views

recording 2 videos of 2 different pictures

I'm using raspberry pi with python and I'm trying to record a video of : regular video stream a picture from that stream that showes a circle identification (using hough transform ) cv2.circle =...
1
vote
0answers
381 views

Digital Camera - view webcam (not pi camera) and capture image on button click inside a browser - preferrabily php

I am a newbie to Raspberry pi Digital Camera - view webcam (not pi camera) and capture image on button click inside a browser - in php I am trying to write a browser based image capture software ...
1
vote
0answers
97 views

Why was my last AT command routine is not viewed in the output?

As I was using pigpio ,so that I can use the GPIO pins as UART or bit banging the serial. I am using a SIM900 gsm module. Here is the code: import pigpio import time import sys TX=23 RX=18 baudrate=...
1
vote
0answers
571 views

With RPi 3 cannot write to I2C

I have an Adafruit RPI3 running Raspbian version = "8 jessie". I connected a CO2 sensor via I2c and the sensor properly responds to i2cdetect -y 1 with 0x68 and 0x69. I believe these are read and ...
1
vote
1answer
349 views

Access GPIO pins through a Flask + Apache/mod_wsgi

I get an internal server error when I import the gpio pins library in my simple __init__.py file. And the debugger doesn't show up. As I understand it, the server doesn't have the permission to ...
1
vote
0answers
612 views

Optimization of picamera frame decoding for opencv processing

I am useing next code for frame capture: from picamera import PiCamera import utils res = (1600,1600) camera = PiCamera(resolution = res) camera.resolution = res camera.raw_format = 'rgb' camera....