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/

3237 questions
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
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
11
votes
14 answers

PiCamera not Working

For starting the camera I am doing >>> import picamera >>> camera = picamera.PiCamera() mmal: mmal_vc_component_enable: failed to enable compononent : ENOSPC Traceback (most recent call last): File "", line, in ... …
Coderaemon
  • 465
  • 1
  • 11
  • 21
10
votes
6 answers

Python and OpenSSL error on import

So I'm trying to add SSL to my web server running on my pi B+ (using cherrypy) I made sure that OpenSSL was installed with: sudo apt-get install openssl Then I installed pyOpenSSL with: sudo apt-get install python-openssl In both cases it…
jrel
  • 225
  • 1
  • 2
  • 8
9
votes
2 answers

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 so that I don't have to switch versions every time…
John Foggitt
  • 91
  • 1
  • 1
  • 3
7
votes
4 answers

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 gives detailed instructions on how to do it, it may…
Josh Bannister
  • 83
  • 1
  • 2
  • 7
7
votes
1 answer

How to prevent python script from running more than once?

I want to prevent starting the program if it is already running. Right now the same user can start the program multiple times and cause unexpected behavior. Is this something I should solve at the linux level (e.g. chmod something) or at the python…
tarabyte
  • 665
  • 3
  • 7
  • 13
7
votes
2 answers

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 come with it - whenever a game starts it says "press a…
Chris
  • 71
  • 2
6
votes
2 answers

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…
Coderboy
  • 61
  • 1
  • 1
  • 2
6
votes
1 answer

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, so it should've installed everything correctly.…
ohblahitsme
  • 741
  • 1
  • 7
  • 18
6
votes
4 answers

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 = GoogleDrive(gauth) file1 =…
Gilson
  • 91
  • 1
  • 1
  • 5
5
votes
2 answers

How do I run a python program as a process in the background?

I have made a little python program that lights up some LEDs to display the current heat of the pi, but I want to run it while I'm doing other stuff. I don't want it to run in a window because I often use command line. Is there a way of making doing…
Matthew
  • 979
  • 3
  • 10
  • 20
5
votes
1 answer

When do I want Python 2 vs Python 3 on the Pi?

I've never programmed in Python, but I recently came across an article talking about the differences of learning Python 2 vs Python 3 and committing to one version or the other. What are the abstract level differences between Python 2 and Python 3…
YetAnotherRandomUser
  • 1,120
  • 2
  • 10
  • 34
5
votes
1 answer

Does RPi 3 have BLE (Bluetooth Low Energy/Bluetooth 4.0/Bluetooth Smart)

I am wondering if the RPi3 has BLE built in. (Not standard bluetooth, but BLE) And if it does, how do I find BLE devices or install BLE software or whatever, as I know Raspbian doesn't support BLE itself.
user61421
5
votes
1 answer

Zbar Installation

I'm attempting to install zbar on my raspberry pi. I built the source by entering: ./configure make make install I don't get any errors or warnings from any of the above commands. After the install finishes, I enter python and attempt to import…
user3202
1
2 3
17 18