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
171
votes
1 answer

What is the difference between BOARD and BCM for GPIO pin numbering?

When using the RPi.GPIO library in Python you have to call import RPi.GPIO as GPIO and then GPIO.setmode(GPIO.BOARD) or GPIO.setmode(GPIO.BCM) What is the difference between these two options?
mirams
  • 3,868
  • 4
  • 16
  • 22
47
votes
7 answers

Playing audio files with Python

I am looking for a well maintained Python library with allows me to play audio files on my Raspberry Pi using the standard audio output. So far I've tried several, but none of them seem to work. Although pyglet works on my regular computer fine, it…
Stein
  • 1,758
  • 3
  • 14
  • 13
43
votes
6 answers

How do I update my RPi3 to Python 3.6?

Python 3.6 just came out. I tried following these instructions to build from a tarball, but it got hung up on the make command, so I terminated the process after 20 minutes or so. I also noticed that while the ./configure command was going, a number…
Justin Palmer
  • 539
  • 1
  • 4
  • 3
37
votes
10 answers

Detect that a python program is running on the pi

I've got a python script that uses sys.platform.startswith('linux') to test if it is on linux or not, but then I can't tell the difference between the x86/64 processor, and the raspberry pi's ARM processor. The reason I need this, is to run an…
jnesselr
  • 473
  • 1
  • 4
  • 5
34
votes
6 answers

Recommended GUI toolkit for Python development on the Raspberry Pi

I am teaching my daughter Python (and myself to some degree) using the Pi, and we have had a great time so far - but the CLI can only take us so far. I have started looking at other toolkits, specifically wx, Qt and GTK. These all seem to have great…
Goyuix
  • 755
  • 2
  • 7
  • 13
33
votes
10 answers

Running a Python script at startup

This question has been asked quite a few times before but I didn't seem to get it working using the existing information. My Pi runs Raspbian. I have a Python script named dnscheck.py which loops forever. I need it to run at boot. I know I have to…
Vlad Schnakovszki
  • 1,261
  • 2
  • 15
  • 17
33
votes
2 answers

How to program a USB device with Debian/Python

The Pi is being promoted as an educational device primarily for Python. Inline with this, there have already been some great examples online of people accessing the GPIO from Python. However, most off-the-shelf (rather than home brew) peripherals…
winwaed
  • 1,459
  • 2
  • 15
  • 25
31
votes
3 answers

How can I use the GPIO pins as digital outputs?

I've read that the Raspberry Pi has a number of input and output pins. How can I switch them? (from Python?) What voltage logic? Do I need pull-up or pull-down resistors? Do I need to switch the pins from inputs to outputs? Which pins are…
Alex L
  • 7,585
  • 12
  • 42
  • 53
29
votes
9 answers

How can I control an RC servo?

I'd like to control a small RC servo (5 V, 500 mA) from the GPIO pins via Python. Hardware What are the required electrical connections? Can I connect multiple servos to the Raspberry Pi? Are there any current limitations? Do I need to buffer the…
Alex L
  • 7,585
  • 12
  • 42
  • 53
27
votes
2 answers

How to get Python to work with Lighttpd?

I've got Lighttpd setup on my Raspberry Pi, but I'd like to get server-side code working now. I'm familiar with PHP, but I figure I should try Python as it's supposed to be the "go to" language for the Raspberry Pi. How can I get Python handling…
Mark Ingram
  • 879
  • 3
  • 11
  • 18
23
votes
5 answers

ImportError: No module named RPi

I am trying to run a package on my Raspberry Pi: At the terminal, I typed in “sudo apt-get install picap” followed by enter. I get it installed but cannot execute "picap-setup" – instead an error message follows: pi@raspberrypi:~ $ picap-setup…
99centsdreams
  • 339
  • 1
  • 2
  • 4
23
votes
7 answers

Raspberry Pi starting programs automatically on startup

I've built a wireless sensor network consisting of two Raspberry Pi's (runnnig Raspbian) with sensors on and a base station Raspberry Pi that collects the data. Each time I want to run the system I have to log into each sensor unit and run two…
Kersakov
  • 415
  • 2
  • 5
  • 9
22
votes
5 answers

How to correctly install the python RPi.GPIO library

I downloaded RPi.GPIO 5.3a from here: https://pypi.python.org/pypi/RPi.GPIO I extracted the tar file, cd into the folder and ran: sudo python setup.py install It ran through a bunch of stuff and doesn't seem to have failed. The last line of its…
FoamyGuy
  • 429
  • 1
  • 5
  • 10
22
votes
3 answers

Why are some GPIO pins HIGH when the Raspberry Pi boots up?

I have an easy circuit wired up, with an LED connected to pin 18 on the BOARD reference. I run a simple program to put pin 18 to HIGH, which turns the LED on, and then a couple of seconds later, I set pin 18 to LOW, and finally I end my program with…
Viktor Raspberry
  • 415
  • 2
  • 4
  • 8
21
votes
5 answers

Which Python IDEs/interactive shells are best suited to the Pi?

I know this is perhaps slightly dodgy teritory, but I'm going to go ahead. I'm wondering which of the many python IDEs/interactive shells are best suited to the RPi? By this I mean low RAM, and fairly low memory on the SD. If anyone has any other…
ACarter
  • 2,350
  • 6
  • 25
  • 39
1
2 3
99 100