Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [python-3]

Use this tag when referring to the Python 3 language. This can include discussions about specific features unique to the language or perhaps when referring to software that requires Python 3 in order to function. Note that general programming questions are often better suited to Stack Overflow; use this tag only where directly relevant to the Pi.

0
votes
0answers
10 views

Pygame initalisation for TFT on /dev/fb1 only succeeds as root

I connected a 320x240 TFT to my Raspberry Pi A+ running Raspbian stretch via SPI and set it up as fbtft_device. It shows up in /dev/fb1 and I can write images to it via pygame. I initialize it like ...
0
votes
0answers
19 views

How can I install/use smptlib in Python 3.x with Thonny

I have got this response. I have no idea how to avoid it: Traceback (most recent call last): File "/home/pi/Franz/email3.py", line 2, in <module> import smtplib File "/usr/lib/python3/...
0
votes
0answers
25 views

MQTT connection to broker

Hello I would like to configure paho mqtt but I am having trouble to get it to work properly. I am trying to connect my raspberry to external server where broker is up and running. Port and IP are ...
1
vote
1answer
32 views

JSON not working with LIRC

I have the following script which is meant to write/read a json file. The problem is it will only write/read the file from the command line and not when using a remote via LIRC. import RPi.GPIO as ...
0
votes
1answer
63 views

prevent script running twice consecutively - Python

I have the following two Python scripts one sends a motor forward while the other script sends it backwards. Each script is operated by it's own button on a remote. Script A import RPi.GPIO as GPIO ...
-4
votes
0answers
33 views

I need help coding a toggle button for led? [duplicate]

I have hooked up my circuit and it works as a hold button to turn light on. Then when I let go of button light turns off but I have found no way to make a toggle button for led. If somebody were so ...
0
votes
0answers
16 views

Gpiozero inside custom function

So I have a odd problem. I have raspberry pi model 3 using gpiozero in python 3. Just trying to turn on the motor at half speed when calling the function. Issue is that nothing happens when ...
0
votes
2answers
53 views

How to make a button toggle a led?

I have some code which turns an led on when I hold the button. But only when I am pressing it. Could somebody help me so when I press the button then the light stays on and if I press it again the led ...
0
votes
1answer
20 views

Need help blinking a led continuously?

I'm new to Python and just go this Raspberry Pi, and need help blinking this led. I have got it to where the LED will blink once( Turn on for a second, then turn off). I need some help so when I hit ...
0
votes
0answers
31 views

Not able to install the latest version of Scipy(1.2.0) on Raspbian

I have Scipy version 0.18.2 on my RaspberryPi 3. However, I need the find_peaks() function which is only available on higher versions. I followed this link to install scipy. But the python3 setup.py ...
2
votes
1answer
38 views

read variable and trigger event - python

I have the following script which increases the counter variable every time a button is pressed. When counter reaches a certain number i.e. 10 lets say I want an event to trigger. from time import ...
0
votes
0answers
52 views

Installing gstreamer on raspian

I am trying to compile gstreamer 1.14.4 to take advantage of the webrtc module. I was able to successfully compile it using cerbero on my raspberry pi but I have an issue where when testing my webrtc ...
-1
votes
0answers
24 views

real time voice to qrcode using pyhton

How to convert audio signals to QRcode using raspberry using python.I want to record the voice using a microphone and convert it into QRcode.When I scan the QRcode the audio should be played.I have ...
1
vote
1answer
34 views

Running a Python Script with Tensorflow via systemd doesn't work, but running the same script via the terminal works

I have successfully coded a Python 3 Script that detects objects in a frame given my the camera. Based on those objects detected, I run commands and logic. I have tested this and I can run it via the ...
0
votes
0answers
54 views

problem connecting with port serial0 for serial comm

I am facing this issue that I can't solve, I've been on this like 3 days and it is really frustrating! I'm trying to test AT commands through port serial0, I've tried it in a python file and when i ...
0
votes
1answer
38 views

How can hide ffmpeg output?

os.system('ffmpeg -ss 00:08:00 -i '+dAdi+' -frames:v 1 /home/pi/Desktop/filmekrangoruntuleri/'+egAdi+'2.jpg') When I run my python(3) script through the terminal, I see the following outputs produced ...
0
votes
0answers
43 views

Using Python smbus to communicate with Smart Battery

Getting I/O errors when using Python 3 smbus module under Raspbian to retrieve (read) data back from a laptop Smart Battery. A similar program coded in C for Arduino works perfectly with this battery. ...
0
votes
1answer
25 views

Is in Python anything like in Java platform.exit() to leave the program [closed]

I got a Button and when the Button was tapped it runs a function. Till here I got everything ready. And now my question I will close the program correct like in the title. Is in Python anything like ...
1
vote
1answer
113 views

Upgrading to Latest Numpy Version on Raspberry Pi 3

I'm not sure if this is a Raspberry Pi issue, Raspbian Issue, Python Issue, or all of the above. So forgive me if this is the wrong place to ask this. I just got me a Raspberry Pi 3B+ and installed ...
0
votes
2answers
79 views

AttributeError: 'NoneType' object has no attribute 'send' pigpiod

So I create an another program that can run stepper motor clockwise and counter clockwise with a ramp up and ramp down in there and adding limiter switch on GPIO 16 and 26 to stop the pi....
0
votes
2answers
20 views

Program not able to open file at start up but when running from command line, runs as expected

using a library from https://github.com/BLavery/LIBtft144 this line of code doesn't seem to run when I run the program from a systemd. I also tried calling it from a crontab call of my .py program. ...
0
votes
1answer
34 views

GPIO LED Python

I am not sure what I am doing wrong here. I found this guide on but it's not working for me. The program does not output any errors but the LED doesn't light up. I have and LED with + on GPIO 12 ...
0
votes
2answers
578 views

Installing Python 2.7

I am new to the Raspberry Pi, I have a project. I would like to work on Python 2 not Python 3. By default Python 3 is installed on my Pi. I want to change or remove this version and I want to ...
-2
votes
1answer
38 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 ...
0
votes
0answers
27 views

DC Motors Not Moving, Programming or Wiring Error?

I got a Raspberry Pi 3B, That ive hooked 4 DC motors up to (with a motor controller of course). I run the program and they do not move, i cant figure out if im missing something or wired something up ...
0
votes
1answer
62 views

pigpio python serial wave output not correct

I am trying to use joan's pigpio to write a serial command on my Rpi 3 gpio 14(UART0TX).My goal is to write a command from the pi to another device. When i send the command i do not see the ...
0
votes
1answer
42 views

cv2.line is not working in Rpi 3

model no: RPi 3 B Software: Python 3.5.3 Problem: I am using opencv 3.4 .I was trying to draw a line using function cv2.line().But it returns nothing.But the same code was working fine in my laptop ...
0
votes
0answers
37 views

Flask/Apache running @app.before_first_request twice

I have my raspberry pi running flask/Apache. I have a background task that I run using multiprocessing. (I know celery does this, but I just wanted something simple). My issue is that the background ...
0
votes
1answer
46 views

Installing library to raspberry pi problems

I'm trying to install a library to my RPi 3 B, but for some reason when I try to import it in my script, it won't recognize the library. This is the library: https://github.com/widgetlords/...
0
votes
1answer
86 views

Reading Real-Time Temperature of Raspberry Pi in Guizero

Is there an option to display Raspberry Pi's internal temperature value to be able to display it into Guizero UI? I saw this source code on GitHub, but this only displays random float numbers in the ...
0
votes
1answer
179 views

Stream Deck Using PI 2

I have a RPi2 1gb. I've recently got a touch screen for it and have decided that I actually should use it for what it was intended for. Programming! So my adventure starts here. I want to make a ...
0
votes
0answers
50 views

GSM/GPRS SIM800L working in England,UK

I am from England and I am using SIM800L Module for sending the SMS. My module is not connecting with the network. I don't know what's the issue, I wanna know whether this module (SIM800L) works in ...
0
votes
0answers
47 views

AttributeError: ge_add_event_data

I get this error when i try to import pynput to control my motor using keyboard: Traceback (most recent call last): File "/home/pi/.local/lib/python3.5/site-packages/Xlib/display.py", line 224, in ...
1
vote
0answers
42 views

Pi-3, Model B, SenseHat - How can I restart my code while it's active.?

I am new with python and PI. I have been looking all over for information about this but with no luck. currently it works like this: I start the program, I press the button and then it starts counting ...
0
votes
1answer
36 views

Tkinterhtml fails to run on raspbian. Python 3.7

Tkinterhtml fails to run on Raspbian. Python 3.7 _tkinter.TclError: couldn't load file "/usr/local/lib/python3.7/site-packages/tkinterhtml/tkhtml/Linux/32-bit/Tkhtml/libTkhtml3.0.so": /usr/local/lib/...
0
votes
2answers
35 views

Is it possible to find the current sampling rate of MCP3008? [closed]

I am using MCP3008 with Raspberrypi Model B. MCP3008 is sampling the analog signal. But is there any way through which I can verify if it is correct or not. For example, I need a sampling rate of 1.5 ...
0
votes
0answers
18 views

Is it possible to use half the screen as touch screen and the other half as a waveform display pane?

I am using waveshare 3.5 inch RPi LCD (A). Is it possible to use it as just a display for waveforms and half the screen of it responsive to the touch?
0
votes
0answers
79 views

Running python in PHP shows error. -sudo: no tty present and no askpass program specified

I want to run a python script to turn an led on from PHP. The script did not run. I used echo to print the error. It said "sudo: no tty present and no askpass program specified". What should I do? ...
1
vote
2answers
78 views

crontab schedule .py file

I am attempting to run a scheduled .py file every 5 minutes with crontab but I don't think it's working. I'm following this post with the instructions: Can't run python script from cron I opened ...
1
vote
2answers
261 views

open a terminal on boot and auto-run a looping python script

When my RPI3 is booted, I would like it to automatically have the terminal open with my python script already running. Note that it loops endlessly. I want to open the terminal so I check the output ...
1
vote
1answer
119 views

Python script not running when added to crontab

I have an on_reboot.sh file that contains the following: #!/bin/bash source /home/pi/.profile workon cv cd /home/pi/reboot python pi_test.py After that I made the file executable using $ chmod +x ...
1
vote
1answer
854 views

How to fix Remote I/O Error Whilst Using i2c OLED

I was using my i2c OLED perfectly well when seemingly for no reason I started getting the Remote I/O Error when I ran my Python program. For some reason this was fixed by installing i2c tools again. ...
0
votes
1answer
41 views

Picamera (in Terminal and Python 3) just does nothing

I have a Picamera V2, a brand new Flex Cable (so that's not the problem) and a Pi 3B. I am using VNC from Ubuntu. The Pi connects OK. But in the terminal (raspistill - o hi.jpg) and in Python 3 ( ...
-1
votes
1answer
35 views

python basic problem in developing raspberry pi 3 GPIO skill

this is a part of a code for picroft skill: def handle_command_intent(self, message): if message.data["command"].upper() == "BLINK": self.speak_dialog("ledblink") the "data" and "...
0
votes
1answer
33 views

Run python function once usb is mounted [closed]

I'm currently having a problem on how can I run a python function once the user mounts a flash drive. I have a GUI that's in idle mode and the user can start using when he/she plugs a flash drive. ...
3
votes
0answers
187 views

Accelerated Numpy on Pi 3 B+

I'm looking to do some work with NumPy on my Pi 3 B+, and I'm not sure what the deal is with optimization, blas, etc. I installed libatlas using: sudo apt-get install libatlas-base-dev Following ...
0
votes
0answers
20 views

Rpi stops giving encoder data

I am again reposting my question. I am working on a hobby project and I have written the code to take encoder data and calculate the motor RPM which works fine. But sometimes it is very strange that ...
1
vote
1answer
112 views

Why does my raspberry pi zero w crashes when controlling a DC motor with an L9232D and a 9g Servo motor?

I use this simple circuit to control a DC motor with an L293D, and a 9g servo motor with a Raspberry PI Zero W: I use the simple following code to test the circuit: from time import sleep import RPi....
2
votes
0answers
4k views

How to install Python 3.7 with SSL? [closed]

I have compiled and installed Python 3.7 on my Raspberry Pi, but SSL is not working. These are the steps I took to install the new Python: Prerequisites: $ sudo apt-get update $ sudo apt-get ...
1
vote
2answers
89 views

Autostarting a python script at boot not working in /etc/rc.local and systemd

I am working on a data acquisition project where I am sending a bunch of sensor data to the cloud. Here is a small snippet from my code: #!/usr/bin/python3 # coding: utf-8 import ctypes from systemd ...