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
20
votes
4 answers

Using Raspberry Pi to control my AC via infrared

When I'm on my way back home from somewhere, I want to be able to switch my AC on a few minutes before I arrive at my apartment, probably by using my phone to connect to my Raspberry Pi on my desk which will, in turn, control the AC. The AC is…
Ram Rachum
  • 330
  • 1
  • 2
  • 7
19
votes
3 answers

Why cleanup the GPIO pins?

When running a program in Python, why would I want the cleanup command when using the GPIO's?
Human
  • 1,158
  • 3
  • 14
  • 35
17
votes
3 answers

GPIO: Warning Channel already in use

gpio.py:5: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings. GPIO.setup(8, GPIO.OUT) That is what I get after I run: import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(7,…
LilVinny
  • 420
  • 1
  • 4
  • 16
17
votes
3 answers

How do I run a command line command in a Python script?

I'm using 2 separate scripts, Scale1.py and Scale2.py. To run them I enter sudo python Scale1.py or sudo python Scale2.py from the terminal command line. I would like to have a line in the Scale2.py script in which if I press a button, the program…
Rico
  • 273
  • 1
  • 2
  • 4
17
votes
2 answers

How do I read a button through the GPIO?

I considered myself out of this sort of beginner level stuff a long time ago, but I guess I'm not as smart as I thought I was because I seem to be having an exceptional level of trouble with it! So I've finally finished exams and can play with my…
Michael
  • 171
  • 1
  • 3
17
votes
4 answers

How can I use more GPIO ports on the Raspberry Pi?

I am currently planning a project for a course at school which involves using the Raspberry Pi - however I'm worried that I will not have enough GPIO connectors for the inputs and outputs that I will need for the project. What could I use to allow…
ChaoticPanda
  • 395
  • 2
  • 3
  • 7
16
votes
4 answers

How can I lower the usage of CPU for this Python program?

I will be having a Python run 24/7 in a while loop, here is an example of the sort of program: while True: print ("me again...") But when I run it, my CPU goes to 100%! But I don't want that since my program will run for long lengths of time,…
user151324
  • 1,270
  • 4
  • 14
  • 17
16
votes
3 answers

How to Run pigpiod on boot

In order to use pigpio Module in Python (remote GPIO for Raspberry Pi ), pigpiod has to be loaded to memory on each RPi. what is the right way to to it ? during Ubuntu's boot or a part of Python's script ? since It needs sudo pigpiod- how is it…
guyd
  • 558
  • 3
  • 12
  • 28
16
votes
3 answers

Execute Python Scripts Via Web interface

I have seen a lot of projects which claim to control the GPIO pins, but I want something a bit different, for example, to be able to blink an LED. Is there a system out there where, via a web interface, I can click and execute a python script, for…
J.Zil
  • 271
  • 1
  • 2
  • 4
16
votes
5 answers

How do I install pandas on Raspberry Pi?

I'm trying to install Python Pandas on my Raspi and I'm finding strange errors. ~ $ pip install pandas Downloading/unpacking pandas Downloading pandas-0.13.1.tar.gz (6.1Mb): 6.1Mb downloaded Running setup.py egg_info for package pandas warning: no…
Jamie Bull
  • 1,097
  • 3
  • 9
  • 22
16
votes
3 answers

Can anyone recommend a simple image viewer?

My boss asked me to find a cheap mediaplayer for some stuff at work. That inspired me to build something on my own, using a Raspberry Pi. My plan is to use udev-rules, to detect usb/sdcard and then launch an image viewer, to display the pictures on…
aztekk
  • 163
  • 1
  • 1
  • 5
15
votes
8 answers

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, there is the vcgencmd command. Example in…
SDsolar
  • 2,308
  • 8
  • 24
  • 43
15
votes
4 answers

Can Python control normal Minecraft, or only the RasPi Edition?

My son wants to make a game in Python that is materialized in Minecraft. If he does that using the RasPi Edition, can that same Python code control the normal Minecraft on a PC? My guess is that Python sends commands to Minecraft rather than running…
Jim L.
  • 325
  • 1
  • 3
  • 12
15
votes
6 answers

Installed pyusb, still: 'ImportError: no module named core'

On my Raspberry Pi I installed libusb and pyusb via sudo apt-get install libusb-dev python-usb. But running some Python code (pyrow, to read data from a rowing machine) gives me this error at import usb.core: ImportError: no module named core This…
A. Goossens
  • 293
  • 1
  • 2
  • 8
15
votes
1 answer

How do I update Python to version 3?

Is there any way to update Python on the Raspberry Pi (Wheezy) to Python 3.3?
xxmbabanexx
  • 3,248
  • 7
  • 33
  • 56