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.

Official website http://www.python.org/

3193 questions
15
votes
5 answers

Falls off network ("Destination host unreachable")

I am running my Raspberry Pi headlessly, connecting via SSH over the network. I am having a problem that I can consistently reproduce. I will leave a Python script running on my Raspberry Pi and come back a few hours later and SSH connections to the…
Andy Smith
  • 432
  • 1
  • 5
  • 19
15
votes
4 answers

How can I connect to a USB serial device?

I have a device with a USB serial port cable that I'd like to connect to my Raspberry Pi. The chipset for this USB to serial cable it the PL-2303 from Prolific Technology, Inc. How can I read data from the serial connection of this device using…
Swinders
  • 255
  • 1
  • 4
  • 11
14
votes
5 answers

PyQt5 on a Raspberry Pi

I have a Raspberry Pi 3 with Raspbian installed, along with a 7" touch screen. I'm in the process of creating an application in Python to read several DS18B20 Thermocouples to monitor the temperature of several aquariums (relays attached to heaters…
CharlieHorse
  • 497
  • 1
  • 4
  • 12
14
votes
2 answers

Compare and contrast Python GPIO APIs

I'm just starting with Pi and want to program GPIO in Python. So far I've come across five libraries: WiringPi-Python RPi.GPIO RPIO gpiozero pigpio Before I commit time to learning one, I want to know: If there are any limitations to one or the…
spinkus
  • 311
  • 2
  • 3
  • 8
14
votes
1 answer

Raspberry pi GPIO input pins give random values

I've been playing a lot with the Raspberry Pi lately. But I have a problem. When I set up an input pin to check whether electricity is sent to it or not, it gives me rather unstable answers. A few observations I've made to clarify my…
Gustaf
  • 141
  • 1
  • 1
  • 3
14
votes
4 answers

How to include RPi.GPIO in a python CGI script with lighttpd?

I've recently setup python to work with lighttpd via CGI (see here). But the minute I go to include RPi.GPIO, the script stops executing (I'm assuming because no HTML gets output), but there is no error output into the error log…
Mark Ingram
  • 879
  • 3
  • 11
  • 18
13
votes
2 answers

Why does python run relatively slowly?

I've been benchmarking the Pi on some of my simulation codes, relative to a couple of laptops I have. My codes tend to be floating point intensive, so I've been using Raspbian (which turns out to be much faster) due to its hard-float support. I have…
Darren Wilkinson
  • 2,912
  • 4
  • 26
  • 27
13
votes
4 answers

How to boot into own python script (GUI) only?

I have the following problem: Using a RaspPi 3B running Raspbian Jessie (version 4.4.26-v7+) I would like the GUI of a self-written python script to be executed on startup. I know that this question has been asked on this website as well as on…
Fantilein1990
  • 900
  • 1
  • 9
  • 22
13
votes
2 answers

Using OpenCV with RasPiCam and python

Has any one been able to get OpenCV to directly play video from the RasPiCam board using python? I've seen some projects involving workarounds, but what I'm interested in is being able to use the RasPiCam board with OpenCV as if it were a USB…
Ryan
  • 233
  • 1
  • 2
  • 5
13
votes
3 answers

Installing Python 3.4 on Raspberry Pi

Is it possible to run python 3.4 on a Raspberry Pi? Currently I have python 3.2, but the odd thing is that running sudo apt-get update sudo apt-get install python3 results in my Raspberry Pi informing me that python3 is 'already the newest…
starbeamrainbowlabs
  • 324
  • 2
  • 5
  • 14
12
votes
4 answers

How to get the Raspberry Pi's IP address for SSH

I am using Mac OSx to access my Pi via SSH. To access it, I know that I need the Pi's IP address. So, I decided to use a few Python commands which have always succeeded in giving me the local IP. import socket host_name =…
xxmbabanexx
  • 3,248
  • 7
  • 33
  • 56
12
votes
1 answer

Sound recording using python

I'm trying to record some sound with RPI using python and pyaudio library and facing a few interesting issues - junky console output when attempting to use pyaudio and lots of noise mixing into the recording. Here is what I'm doing in my python…
abolotnov
  • 952
  • 1
  • 7
  • 15
12
votes
1 answer

Is it possible to communicate with I²C devices via the GPIO?

Is it possible to communicate with I²C devices via the GPIOs? Also, are there any existing drivers or libraries that make this possible from Python?
Damian Powell
  • 229
  • 2
  • 6
12
votes
4 answers

12V device to a Raspberry Pi

For my school engineering project, I have a coin acceptor device which I would like to link to the Raspberry Pi. However the device requires 12V in power. I have an idea of what to do to power the device, however I have heard that there is a risk of…
ChaoticPanda
  • 395
  • 2
  • 3
  • 7
11
votes
2 answers

Loop doesn't work unless I use 'print'

This code does not turn the led on and off. import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(21,GPIO.OUT) for number in range(0,10): GPIO.output(21,GPIO.LOW) time.sleep(1) …
tazboy
  • 221
  • 2
  • 5