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.

Filter by
Sorted by
Tagged with
9
votes
3answers
16k views

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 ...
9
votes
4answers
31k views

Why is Python the preferred language for the pi

Why is python perceived as the preferred language to control and manipulate Raspberry Pi? Why is Python language chosen over other other programming languages like PERL, etc. (which are included ...
9
votes
3answers
91k views

How do I display an image file (PNG) in a simple window?

I've got a prototype I need to show for an RFID project. I've got the RFID (Parallax USB) working, and the sample Python script (my first) is displaying the ID of the card just like it's supposed to......
9
votes
2answers
19k views

What's the right way to run a python script as a daemon (service) in raspbian (or debian)?

I'd like to use my Pi as a home thermostat, with the control loop running in a python script. I want to run it as a daemon on raspbian (debian) at startup. There's an example bash script in /etc/init....
9
votes
2answers
18k views

How do capture audio using Python?

More particularly: How can I use python with ALSA to capture audio input? I'm thinking about doing an oled-based spectrum analyzer for Pi-based audioplayer. One part of the solution is to read the ...
8
votes
5answers
24k views

gpio library on windows while developing

I am new to Python so maybe this is not an appropriate question. I am working on a project on Python that will use GPIO functionalities of the raspberry Pi. Right now, I am developing the python code ...
8
votes
2answers
29k views

installing OpenCV 3.0 on raspberry pi b+

Is it possible to install OpenCV 3.0, opencv python on Raspberry pi b+? How to install and are there any precompiled binaries available ?
8
votes
6answers
37k 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, ...
8
votes
3answers
16k views

Can I run Selenium webdriver using Firefox as the browser?

I would like to set up the Raspberry Pi as a client that exclusively runs FireFox as a client in a Selenium grid. Has anyone tried and got this to work? Are there any tips or pitfalls that I will ...
8
votes
2answers
9k views

Implement a GPIO function with a callback calling a asyncio method

I am testing a sensor attached to the GPIO in raspberry using python 3.5. The idea is something similar to this link. My code is: gpio.add_event_detect(4, gpio.RISING, callback=lambda x: self....
8
votes
1answer
17k views

How to use the water flow sensor with raspberry?

I'm trying to use this water flow sensor with raspberry: https://www.adafruit.com/products/828 I'm using this python code to read the pulses: #!/usr/bin/env python import RPi.GPIO as GPIO import ...
8
votes
1answer
35k views

Bluetooth import for Python Raspberry Pi 3

I have successfully connected my cell phone to the Raspberry Pi's onboard bluetooth. I know the Bluetooth works, but I cannot get import bluetooth to work properly. I get this error when I run the ...
8
votes
3answers
817 views

How does init get to know about power events?

I have a Pi Model B Rev 2.0 (I think) and I intend to use it for a Home Automation system. As I have a prepayment meter on my electricity supply I occasionally run out of electrons to go around my ...
8
votes
2answers
24k views

Streaming Raspberry Pi camera to HTML webpage using picamera and Flask

I am trying to use the picamera API and Flask to implement a pure Python (live) stream of the continuous JPEG from the Raspberry Pi camera module to display it using a HTML template but I keep getting ...
8
votes
1answer
52k views

Real time audio input/output in Python with PyAudio

I am trying to get my Raspberry Pi to read some audio input through a basic USB souncard and play it back in real time for 10 seconds, and then print the output with Matplotlib after it's finished. I ...
8
votes
2answers
13k views

I want to switch between versions 2 & 3 of Python. Both are installed

If I double click on a .py file it opens "IDLE" (is there another way to open "IDLE"?), but the default python version is 2 when I select "run". I want to PERMANENTLY change the default version to 3 ...
8
votes
1answer
2k views

Raspberry Pi Camera - When is it ready for next frame

When using apis like the C++ or raspicam api, you poll the camera with a grab(), or similar, method. When a frame is ready, the method returns. Is there a way of checking if the camera is ready ...
8
votes
1answer
55k views

Using python with bluetooth to communicate

I'm trying to write a simple program to communicate between the RPi and a bluetooth cellphone. I went with this tutorial: Bluetooth Python tutorial for RPi and was able to connect to the phone and ...
8
votes
2answers
10k views

GPIO pins are always HIGH

I recently have started delving into using the GPIO on my raspberry pi and when I got to the input section of adafruit's tutorials I noticed something wrong. For some reason when I execute the python ...
7
votes
6answers
13k views

Testing Raspberry Pi scripts on a PC

I'm writing a Raspberry Pi program, to run stuff, take inputs from sensors, save in database and synchronise to a server. Is there a way to test it on the PC before deploying it to the Raspberry Pi? ...
7
votes
3answers
43k views

How to download and install Python 3.5 in Raspbian

Tried to use sudo apt-get install python3.5 and it's telling me that it can't find it. Have tried updating. Not sure what else to do.
7
votes
4answers
32k views

Ping a website and have an output turn on if online/offline?

I am new to python and programming the Pi, my aim is to make it ping a server such as a gaming server or website and tell me if it is online or offline. So far I have looked everywhere but nobody ...
7
votes
3answers
64k views

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....
7
votes
5answers
25k views

How to blink LEDs on/off continually, while continuing execution of a script?

I've connected red and green leds via GPIO and I can successfully switch them on/off using RPi.GPIO - now I'd like to: start an led blinking on/off every 1 second have the script continue its ...
7
votes
1answer
479 views

Bit waveform clarification

I have been trying to learn more about bit transmission through the uart, and I have the following code in python to transmit information: import serial ser = serial.Serial( port='/dev/ttyAMA0',...
7
votes
2answers
1k views

Issue with push button on raspberry PI

I'm currently working with Raspberry Pi. I have implemented push button(switch) program using python. But, When I press the switch, then if condition is true and data stored but when I release the ...
7
votes
3answers
14k views

Adafruit I2C Library Problem?

I'm having trouble compiling the python from an example in the library. https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code/blob/master/Adafruit_ADS1x15/ads1x15_ex_singleended.py I ...
7
votes
1answer
6k views

Installing libraries via pip is taking forever. Raspberry pi 3b+

I tried to install scipy using pip3 install scipy as well as sudo pip3 install scipy and it got stuck at Building wheel for scipy for 45 minutes. Same is the case for cython. What is the fix or it ...
7
votes
1answer
11k views

Using a class function as callback

I want to set a callback function to run when an event occurs in a GPIO. I'm designing a class and I want to have the callback method inside it too. Here's an excerpt of the code: import RPi.GPIO as ...
7
votes
2answers
5k views

Is there a way to make a regular GPIO pin into a Tx UART pin?

I'm working on a project that is going to need two different UART interfaces. Is there a way to make a regular GPIO pin into a Tx UART pin, I don't need an Rx pin too. Is there a software solution ...
7
votes
1answer
1k views

Raspberry Python Libraries

I am currently working with a Raspberry Pi (Model B+) and have some experience with Arduino (and it's derivates). Now, there are three Libs for GPIO access with Python for the Pi: WiringPi (...
7
votes
2answers
2k views

Problem with Python Games

Having eagerly ripped open my newly arrived toy, I've just installed the Raspbian Wheezy image & am impressed that it really does just boot and appears to work - however, the Python Games that ...
6
votes
3answers
2k views

GPIO status after python code is closed

I intend to write a python script to change the status of GPIO pins. The code will receive arguments through sys.argv, change the state of some GPIO pins, and close afterward. My question is: Do the ...
6
votes
4answers
42k views

Are there any Python IDEs for Raspberry Pi 3 with step-through capability?

I've used PyCharm by Jetbrains on Windows/full blown Linux and I like the ability to step through code. However, due to the processor of the Raspberry Pi 3, it doesn't run very quickly. Can anyone ...
6
votes
3answers
18k views

Debouncing buttons with RPi.GPIO — too many events detected?

I'm using RPi.GPIO to handle events from a simple pushbutton. Pushing the button connects the associated GPIO pin (4) to ground. I would like to trigger an event when the button is released (e.g., ...
6
votes
3answers
2k views

Is there any built in LED connected with GPIO pin?

In Arduino a built in LED is attached with number 13 Digital pin. Is there any LED like Arduino in Raspberry Pi,which I can use to test my code?
6
votes
2answers
9k views

Can I run TensorFlow on the Raspberry Pi?

I wan't to know if TensorFlow (http://tensorflow.org/) can be used on the Raspberry Pi both the Python API and the C++?
6
votes
4answers
8k views

Do we need multiple versions of Python?

I am new to Linux and going through my installed folder I can see there are four different Python folders in the directory list. python python2.7 python3 python3.2 Do we need all the four versions ...
6
votes
4answers
12k views

5v Relay will not close (unless using GPIO cleanup)

This seems like it should be really simple, so maybe I am missing something. I am just trying to open and close my relay but all it does it open's and doesnt close. I can use GPIO.cleanup() to make it ...
6
votes
1answer
4k views

BlasNotFoundError when installing Scipy through pip

I'm trying to install Scipy in a virtual env through pip and I'm getting an error that says numpy.distutils.system_info.BlasNotFoundError I've never run into this before and I installed numpy from pip,...
6
votes
4answers
2k views

Temporary blocking all network access for a limited time while a CPU sensitive task is running

I'm trying to find a way to block all internet access (and local network access) to a Raspberry Pi 2 for a limited time while an important task is running. The problem is, my Pi is doing a video ...
6
votes
2answers
63k views

ImportError No module named thread

I want to make a simple thread that listens if a Button is pressed or not. I receive the error ImportError No module named thread. import RPi.GPIO as GPIO import time import thread GPIO.setmode(...
6
votes
3answers
13k views

YOLO or SSD on raspberry pi

I've run yolov2 on my Raspberry Pi 3 but I got 1 frame each 13s (which is pretty bad for live object detection). I've also tried an SSD but the results were terrible too. Is there anything I could do ...
6
votes
4answers
23k views

Use PyDrive to upload files to Google Drive folder

I'm using PyDrive to upload files to Google Drive but could not figure out how to define the destination folder. The following code saves a copy to the root on GDrive: gauth = GoogleAuth() drive = ...
6
votes
2answers
2k views

What's the RPi camera board called (internally)?

I connected a Rpi-camera board to the camera socket on my RPi (not a usb webcam). I have been searching the internet on how to call the camera in Python. The camera works (raspistill and raspivid both ...
6
votes
1answer
12k views

Which Miniconda version should I use with Raspberry Pi 3?

Hi I am trying to install Miniconda2 4.0.5-Linux-x86.sh on my Raspberry Pi 3. Everything starts fine till it installs:setuptools-20.3-py27_0, line 288 binary cannot be excecuted. Is there already any ...
6
votes
1answer
7k views

Pygame from console with PiTFT

I wrote a simple script that uses pygame to display the information. However, I found that it won't display on screen when I call it from terminal through SSH. I found this guide/solution on adafruit, ...
6
votes
2answers
2k views

Is running a CGI server as root too dangerous?

I've setup my Raspberry Pi with nginx and fcgiwrap as CGI. I wanted to control GPIO ports using a Python script with the Rpi.GPIO library. The problem is that in order to be able to control the ports, ...
6
votes
2answers
14k views

Sending Commands from PC to Raspberry Pi via USB

I am currently doing a project with the Raspberry Pi as a controller connected to a PC via USB and using the Pi to send commands to other devices connected via GPIO pins. Simplified version: ...
6
votes
1answer
4k views

Can I control Minecraft Pi Edition over SSH from another computer?

I recently downloaded the Minecraft Pi edition for my Raspberry Pi. The main feature of the Minecraft Pi edition is the ability to interactively edit the landscape using Python. One would expect that ...

1
2
3 4 5
58