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
-1
votes
1answer
563 views

HelloWorld web.py doesn't work

I've seen web.py recommended in some places as a simple python web framework that I could use in my raspberry, so I went ahead and installed it via PIP (sudo pip install web.py). But when I try to ...
-1
votes
2answers
2k views

Tkinter on linux start up

I put a python Tkinter (GUI library) program on startup (/etc/profile) for my Raspberry Pi Linux and the program just has a label. Now i restart my raspberry pi and it's on my screen without any close ...
-1
votes
1answer
981 views

Accessing YUV data in openCV on the RPi [duplicate]

I came across thisquestion and answer which said how to get a numpy array from raspicam, using the PiYUVAnalysis class. I can output the array itself, But i do not know how to view the array as an ...
-1
votes
2answers
544 views

Glade UI Python serial read loop

I'm writing a python program to monitor for serial activity, and when there is serial activity, to increment a number. When inside the while loop, no other functions will work and I can't modify the ...
-1
votes
1answer
297 views

Raspberry-pi mqttc.publish() to node red overflowing after 20 entries

I am using my python code to publish messages to node-red via mqttc. The problem is after 20 mqttc publish,the data is not getting published to nodered. Here is the python code i used for posting to ...
-1
votes
1answer
938 views

Could not find driver when I trying to display my PHP

After going through a few tutorials of displaying data to php from python and my sqlite database, I keep getting this error and don't know how to fix it. I'm in need of urgent help. Error Message ...
-1
votes
1answer
370 views

How I put a bytearray in python? [closed]

I tried to solve a TypeError:bytearray out of range in diferents forms but I fail fixing this. Someone knows how I put a bytearray with 900000 bytes in python?
-1
votes
1answer
36 views

One coil is always active on my stepper motor(ULN2003)

When I startup my pi or stop my script, the led on the ULN2003 lights up and stays. That means that one coil is active and the motor is heating up. At the end of my script I introduced a few lines of ...
-1
votes
1answer
276 views

Unable to run python script on boot

I wrote a script for object detection and if I establish ssh connection to Raspberry Pi and run it from console, everything works fine. As I would like to start the script automatically on boot, I ...
-1
votes
2answers
792 views

How to run a python program from a bash script on startup?

I have a python script that is located at /etc/testscripts/WebServer. I call this usually from the command line by calling sudo python3.6 /etc/testscripts/WebServer. I have a bash script that looks ...
-1
votes
1answer
242 views

Service won't run python srcipt with privileges RASPBIAN JEESIE

I have script in python that need to be run with "sudo" keyword. Everything because I'm accessing "/dev/mem". Now I need to start this python script on RPi startup. So I create simple service that ...
-1
votes
1answer
1k views

How to remove the kill prompt of a python script?

I have a python script that uses Tkinter, the quit button I have implemented pops up a prompt on the python shell after pressing it, which it didn't do on Windows when I wrote the code and tested it. ...
-1
votes
1answer
297 views

raspberrypi - on boot not running my infinite python script?

I have a Python script, which needs to run 24/7 to use GPIO high/low. So on boot i wanted it to run as below. But it never works to run python script on other hand it does create /tmp/test file? How ...
-1
votes
1answer
477 views

How could I use Wit.ai to get speech to text on my webpage running python script

I want the speech to be recorded by raspberry, send it to wit.ai and then get the response on my page(wich is actually the .py script and according to which I could run my conditions). Actually its ...
-1
votes
1answer
50 views

Multiple circuit on raspberry [closed]

Can I create two circuit on one raspberry? I want to create automated watering system for my home plants. There will be two components in this system 1) water pump controlled through Relay system 2) ...
-1
votes
1answer
1k views

How I can use a barcode scanner and PHP/MySQL to run a database? [closed]

I am currently trying the following with the help of a Raspberry Pi: Barcode scanner scans barcode (connected to the Raspberry Pi via USB Port) (via Python?) A hidden form is filled in The user only ...
-1
votes
1answer
84 views

RPi corrupting one SD card a week

I have a model 3 running some python code as a service. It's never on for more than 30 minutes at a time and is maybe used once a day. However, when I do use it, it is often powered on and off ...
-1
votes
1answer
364 views

Voltage High, low with 0 and 1 using python on a GPIO

Mind the variable creations as they are handled. My questions are the following. 1) Why do we have 2 whiles here? Does the sleep at the end of the first part does really anything significant? 2) ...
-1
votes
1answer
3k views

Reading all channels MCP3008

I have a problem with reading data from adc convertor MCP3008 10bit. I found a python script from adafruit that give data value from all channels (CHO TO CH7). I added a picture with my results and ...
-1
votes
1answer
171 views

Adafruit's LCD doesn't show text

I've just written small python script to operate adafruit's lcd with additional module. Almost every lcd's operation is handled by module. But when I try to print a message on screen or in console, ...
-1
votes
1answer
382 views

Use Pi 3 With Waveshare 3.5" and MFRC522

This message showed up when I was using MFRC522 along with Waveshare LCD 3.5"(A) on Raspberry Pi 3: python Read.py can't open device: No such file or directory Aborted I think it's because SPI is ...
-1
votes
1answer
2k views

Connecting to bluetooth speakers headlessly

Background: I have a Pi Zero that I want to send music to my bluetooth speakers. This works nicely when I have a monitor and can use bluetoothctl to pair and trust my speakers and the volume-adjuster'...
-1
votes
1answer
132 views

how to change the reading channel? [duplicate]

this code is reading from channel 0, how can i change the reading channel MCP3008 adc = pi.spi_open(1, 40000, 0) # Open SPI channel 1. while True: try: c, d = pi.spi_xfer(adc, [1, 0x80, 0]) #...
-1
votes
1answer
42 views

Newbie python issue

I'm trying to write some code to drive a Sense Hat ' I want to use an LED line to indicate the temperature, then scroll it up over time. The sense.set_pixels function expects a list of 64 RGB lists, ...
-1
votes
1answer
186 views

GPIO modes without breaking serial

I am using and Adafruit BNO055 IMU and using their provided modules to read the data, i have been able to do so. However i want to be able to turn some of the GPIO pins to high as i want to control ...
-1
votes
1answer
973 views

Will an automated scp script share files between Pis without Passwords?

I am planning on sending some files within an Ad-Hoc network of Pis. Build Raspberry Pi - 2 Model B Debian Wheezy 7.10/7.11 I am planning to run a cron job between the Pis in vicinity. Through ...
-1
votes
2answers
14k views

Installing all python modules

I'm going on vacation into a foreign country and I want to take my Pi 2 with me to play a bit, not having a particular project in mind. I may not have Internet access all the time or it may be limited ...
-1
votes
1answer
660 views

Error message every time I try to install applications

Error processing line 1 of /usr/lib/python2.7/dist-packages/gtk2-2.0-pysupport-compat.pth: Traceback (most recent call last): File "/usr/lib/python2.7/site.py", line 162, in addpackage if ...
-1
votes
1answer
151 views

can't work xx.py using crontab

I can send the value to domoticz but the problem is that it just changed when I use the command sudo python distance.py I have added * * * * * /usr/bin/python /home/pi/domoticz/scripts/...
-1
votes
1answer
196 views

Python Face Recognizer Error

I got this error during compilation.
-1
votes
1answer
297 views

Piezo sensor to pick up acoustic instrument signal using Rpi and ADC

I want to read analog inputs from piezo sensors like these on Raspberry using python, which ADC do you advise me with 8 or more channels and how to wire and program it to get digital values?
-2
votes
1answer
693 views

GPIO pins available for switches

Among all the 40 GPIO pins, how many of them are available to connect a switch for on-off information? I counted more than 24 GPIO_* connections here, but are they all available via Python? import ...
-2
votes
1answer
8k views

Is there an equivalent to a 'subroutine' in the Python language? [closed]

What is the syntax for creating, calling, and exiting subroutines in Python?
-2
votes
2answers
157 views

Python: how can a delay the repeat of my print command?

My objective is to program a print out a reading, but I want to delay the reprint so that its not spamming me with the reading constantly. try: cpuFile=open("/sys/class/thermal/thermal_zone0/temp","...
-2
votes
1answer
479 views

How to compare the data input from arduino with libreoffice Calc in python [closed]

Was my code for read the libreoffice cal file was right?And i wan send back true or false to arduino after compare the input with cal file. When i key in the number from arduino,no matter correct or ...
-2
votes
1answer
1k views

How to display database in plain HTML or PHP from Python [closed]

How do I just display what's in my database in plain HTML or PHP without any GUI interface or layout, just plain database display? Is it possible? This is my Python code: import sqlite3 import RPi....
-2
votes
2answers
49 views

Can anyone tell me why its skipping the if statement even when the time is 3:37:00? [closed]

class Define_time: def __init__(self): pass d = Define_time() d.real_time = time.strftime('%l:%M:%S') def capture_time(): d.real_time = time.strftime('%l:%M:%S') return d.real_time ...
-2
votes
2answers
117 views

Runtime warning: This channel is already in use, continuing anyway [duplicate]

I'm trying to fix this code for a robot with multiple sensors. The values of TRIG and ECHO are input through another part of the code. Set this at the beginning of the code def init(): GPIO....
-2
votes
1answer
64 views

Ensure/lock a program to run on Raspberry Pi only?

Are there any characteristics/ lock available so that the program would fail to run on any other device except Raspberry Pi. I have thought about using GPIO with external circuits but would prefer ...
-2
votes
1answer
38 views

Ser.write() ,when checked shows only the length

I have used a=ser.write("TEST".encode()) in my code to send data using UART gpio in Rpi. The code shows no error but when I print a,it gives me the length only. Actually i am trying to interface Rpi ...
-2
votes
1answer
963 views

How to upload data from raspberry pi to MySQL, geting errors [closed]

Basically I am trying to upload the data collected from my raspberry pi to MySQL, I have a table called DHT_data with columns 'datetime' using data type timestamp, 'temp' using data type numeric, 'hum'...
-2
votes
1answer
224 views

How to write python to open the another program [closed]

I'm the starter with python. The point is, I want to call program like calculator or terminal by write python code.
-2
votes
0answers
60 views

Two Monitors connection Raspberry Pi4

I want to connect two monitors (Screen A, Screen B) with my raspberry pi4. Screen A is to display content and when the user clicks on it the content display on Screen B. the Screen B will be static ...
-2
votes
1answer
47 views

Start program when a device connects to local wifi

I'm looking for a python program that could detect when device has connected to a local wifi and start a specific program. And would communicate via SMS with raspberry pi.
-2
votes
1answer
42 views

Run a fan 5scs long GPIO

def fan_on(): GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) FAN_PIN = 23 GPIO.setup(FAN_PIN,GPIO.OUT) GPIO.output(FAN_PIN,True) This is my code to run a fan on my rpi via GPIO ...
-2
votes
1answer
185 views

There is a problem with my python source [closed]

i received a lot of help to the Raspberry Pi study for yours thank you so much!! :) but there is a problem to me. i hope as follow 1. The record run 2. If the vibration sensor is detected during ...
-3
votes
2answers
3k views

How to develop a Plugin to read the status of the Power-LED of the Raspberry Pi 3 B by PHP [closed]

I need to develop a plugin that reads the status of the Power-LED of the Raspberry Pi 3 B and print the status of the LED on the Web-page. Please Help !!!
-3
votes
1answer
92 views

How to set ID for multiple sensors like LED, Temperature Sensor and etc?

I would like to know how to set a custom ID to sensors like LED, Temperature Sensor and etc. Example: Like 1 LED sensor, not smart LED. Only can display real time data and nothing else. So I want to ...
-3
votes
1answer
7k views

Which is the standard python library for Rpi other than GPIO library? [closed]

Which python library is best one to use for programming RPI? I want to program RPI zero and Rpi 3 model B+ using python. I know that there is a GPIO library available for RPI. However, in its readme ...
-3
votes
1answer
350 views

Detecting ambulance siren using raspberry pi [closed]

am trying to find a way of detecting ambulance siren using a raspberry pi,I have tried using fast Fourier transform together with numpy in python to isolate ambulance siren but its not working. any ...