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.

Filter by
Sorted by
Tagged with
0
votes
0answers
17 views

Error with apt-get and anything that runs python3

I have an issue with apt-get and any script I will call python3 on my Raspberry running Raspbian Buster. When I run apt-get upgrade (or apt-get dist-upgrade or apt full-upgrade) this happends every ...
0
votes
1answer
65 views

Increase sleep interval for LED sequence whenever button is pressed. (Python)

This is the code: #!/usr/bin/python3 from time import sleep from gpiozero import LED, Button from threading import Thread from signal import pause, signal, SIGTERM LEDs = [5, 17, 22, 19, 26] LIGHTS ...
0
votes
0answers
16 views

2 MPU6050 on Raspberry pi4, different values

I have two identical MPU-6050 connected to a raspberry pi 4, but it looks like one is off in the readings. I don't have another sensor, so can't test that, but I was wondering if it is the sensor or ...
0
votes
0answers
17 views

Cross compiling error in python code for raspberry pi target machine in Ubuntu Virtual machine

I have to compile python code into an executable file. To do that on my RPi3 b+ running Debian stretch. I use cython to convert .py into .c code and then using gcc to create an executable file. The ...
0
votes
1answer
28 views

I want to write a command to putty.exe and after I close it I wannt it to continue

I used to write "python3.7 -m ftg" to rpi 4 model b without a screen, but it doesn't work now and I want to do it with pc. I want to write "python3.7 -m ftg" in putty than I want to close it (command ...
-1
votes
1answer
56 views

How to compile python script to executable? [closed]

I would like to build an executable from a .py source. The executable program must run on my RPi3 model b+ running Debian Stretch. Do you have any suggestion for that?
0
votes
1answer
18 views

crontab wont work

Can someone give me a tip on how to execute a .py file in a directory/folder on the rasp pi desktop? The .py file location is /home/pi/Desktop/ben and file name is tkKerasPredictGmail.py I did an ...
-1
votes
2answers
28 views

TKinter install settings : “module 're' has no attribute 'compile'” on import

If I run a "intro to TKinter" program in Thonny, it runs. From the command line or in Mu it gives this: ( Pi3 b, Buster, fresh apt update - install... ) ..$ python3 code/tkinter_x.py Traceback (...
0
votes
1answer
22 views

My python script does not shutdown when started during startup

So I have a python script that starts as expected during power-on by following: Startup by systemd My Pi has a button connect to GPIO which is used to stop the logger and then shut down the Pi like ...
0
votes
0answers
15 views

Tektronix Oscilloscope under PyVISA on a RaspberryPi 3B +

I am working in a project that requires to control and automatize to devices, a Function generator HAMEG HMF2550 and a Tektronix TDS2024C, which are connected via USB to the RaspberryPi (I will ...
2
votes
2answers
71 views

Can I use the Python Interpreter to list a modules' classes and methods, as well as descriptions? [closed]

I believe there is documentation available online, but for the sake of learning a little more about the interpreter, I am specifically wondering if I can use it to find out what is all available for ...
1
vote
2answers
29 views

How to update Python to 3.5 or later

This Rpi2 has Python 3.4 working - the DAQC2 piplate software install requires 3.5. I can't identify the latest version applicable or find it at Python.org with wget. Alternately, Is there a pre-...
1
vote
0answers
14 views

pigpio servo, stop command not reliable

import pigpio import math import RPi.GPIO as GPIO from gpiozero import Button import time GPIO_SERVO_PIN = 27 limit = 17 switch = Button(limit) GPIO.setmode(GPIO.BCM) GPIO.setup(17, GPIO.IN, ...
1
vote
0answers
27 views

Installing cv2 for python3.7

I've been trying to get opencv to work on my raspberry pi zero w but no matter what I do it doesn't work. I'm using Raspbian Buster Lite (headless) and each time I fail to get opencv to work on the pi ...
0
votes
0answers
31 views

Python3 Program Suddenly Given Error Messages Regarding Request Code

I have been running a python3 program that is using request and it has been running fine for the past month. Today when I rebooted my Pi Model 3B+, I am getting these errors when I restarted the ...
1
vote
0answers
29 views

Raspberry pi: How to toggle a thermal heater

I am trying to build a thermal heater and controller. I have a thermal blanket (https://www.adafruit.com/product/3670) and I would like to be able to control the current to the blanket by control it ...
1
vote
1answer
27 views

pigpiod callback is exiting my code

I have the following code: def read_adc(adc, lsb): # first read adc.writebytes([0x8E]) # ask for channel 0 my_bytes = adc.readbytes(2) # read channel value = (my_bytes[0] << 3) print(value*...
1
vote
1answer
25 views

How to set up an interrupt for a PWM pin

I have a GPIO pin set up as a PWM. I would like to set up an interrupt every time the PWM signal goes high. Is there any way of doing it? I tried mixing the pigpiod library and rpi library, but when ...
1
vote
1answer
60 views

Rpi python GPIO PWM control L298 and PCA9685 motor HAT

I need to find out which GPIO pin on the raspberry pi will be connected to which module when I fit the Adeept Motor Hat v2.0 on the 40 GPIO pins. I am attaching the image and the schematic of the ...
0
votes
1answer
129 views

Rpi python GPIO PWM control L298N motor direction and speed problem

I am unable to understand parts of the code #!/usr/bin/python3 # File name : motor.py # Description : Control Motors # Website : www.adeept.com # E-mail : support@adeept.com # Author ...
0
votes
1answer
52 views

How can Rpi python 3 uses PCA9685 PWM controller to change direction and position of a servo?

I need help understanding the code in the turn.py file, which is a part of the this project, please look #!/usr/bin/python3 # File name : car_dir.py # Description : By controlling Servo,the camera ...
0
votes
1answer
191 views

Rpi python using L298 motor driver and PCA9685 servo controller to change speed and diretion of robot car

I am unable to understand the code provided with the raspberry pi robo kit I got. I need help in understanding the code as I am new to raspberry. Thanks! #!/usr/bin/python3 # File name : ...
1
vote
2answers
81 views

Read USB RFID via tty1 in Python very unreliable

I have an RFID reader (Neuftech USB RFID Reader, https://www.amazon.de/Neuftech-Reader-Kartenleseger%C3%A4t-Kartenleser-Kontaktlos/dp/B018OYOR3E) that attaches via USB. Via /var/log/syslog I found out,...
1
vote
1answer
147 views

opencv not working on Python3

I have installed OpenCv on my Raspberry pi Model 3B. It is working for python 2.7 but not for python 3 The error im getting is: pi@raspberrypi:~ $ python3 Python 3.7.3 (default, Dec 20 2019, 18:57:...
2
votes
1answer
40 views

To perform only one task

How can we prioritize raspberry-pi3b+ model so that if my "code on python" is running then the raspberry-pi should not perform any other task in background. Since i have to calculate time taken by my ...
0
votes
0answers
45 views

How to continuously check Pin status in infinite while loop

I am working with Raspberry Pi 4 and using python for some project. The sample code is as below: while True: if( GPIO.input(a)==GPIO.LOW): if __name == '__main__': try: ...
2
votes
1answer
67 views

Can I use a GPIO and do multiple things with it at the same time?

I have a GPIO that creates the PWM pulse. Would it be possible to have my python code read the same GPIO, and on high execute my code to read the ADC? Would that disrupt the PWM because I'm accessing ...
2
votes
4answers
78 views

Why is my relay switching on automatically when I start my program?

I'm building a little automated hydroponics system using a raspberry pi zero, a 5 volt relay, a pump and a soil moisture sensor from adafruit. So far everything is working, I can pull the pin to high ...
1
vote
0answers
38 views

display a cross-hair within a picture with python3

I want to add a cross-hair pointing to a position within a picture frame and display it. How could this be done effectively using python3? Which library would be preferable?
1
vote
1answer
131 views

Get cheap ST7789 TFT display working through SPI (without CS pin)

I purchased a cheap Chinese ST7789 TFT (1.3in, 240x240) that is clearly identified as SPI compatible, tough it does NOT have a CS pin and also some of the pins seem weirdly named to me. I have been ...
0
votes
0answers
26 views

ADXL345 sampling rate setting

I want to set ADXK345 sampling rate. I wrote the following code in python3 import time from datetime import datetime,timedelta import Adafruit_ADXL345 import threading import pandas as pd import ...
3
votes
1answer
79 views

Raspberry Pi Zero W serial communication

I just got a RPI zero w and I want to communicate to a device through serial comm. I also have a MAX232 board and a RS232 TTL converter. I want to use one of this boards to be able to communicate with ...
1
vote
1answer
37 views

Don't know how to connect multiple MCP23017

I need more pins on my raspberry pi 3 so that I can use it to manage the lights in my house. I am going to use relays and MCP23017. I need to know how to use 8 of the MCP23017 on my raspberry pi. If ...
2
votes
1answer
35 views

apt-get update - trying to install python OpenCV on rasp pi?

$ apt-get update Reading package lists... Done E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied) E: Unable to lock directory /var/lib/apt/lists/ W: Problem unlinking ...
1
vote
1answer
66 views

Can't find python pip on newly installed Buster on my old model B

Anyone else using python and pip on Buster lite? Pip is not working for me on my old dual usb Model B. Just seems to be missing. I tried installing it using the "get-pip.py" module from the official ...
1
vote
1answer
44 views

Can Not able to install python OpenCv on raspberry pi 3?

I have been trying to run my 4WD Smart drive car with raspberry 3. I am using python 3 to implement algorithms and computer vision object detection. I also have a problem with Cheese camera on the pi. ...
-1
votes
1answer
1k views

Why is there an ssl problem after installing python 3.8.1

Hello i'm using a Raspberry pi running Raspian Jessie. I've tried updating the python version to 3.8.1 and it seems I'm having troubles running pip with it. After i enter this line in terminal ...
0
votes
1answer
105 views

Can't sudo apt-get update && sudo apt-get upgrade (won't complete task)

I am having an issues updating my raspbian operating system. After running sudo apt-get update && sudo apt-get upgrade -y I receive the following error messages: Hit:1 http://raspbian....
1
vote
0answers
37 views

Why does native resolution capture with picamera raise 'Incorrect Buffer Length' for Arducam 8MP with IMX219 sensor?

I am trying to capture() full resolution images using picamera.array but it fails raising a PiCameraValueError: Incorrect buffer length for resolution 3280x2464. camera.MAX_RESOLUTION gives ...
0
votes
0answers
46 views

Issues with timestamp creating overflow error

I'm trying to run a python script I wrote on my Raspberry Pi Zero but I keep getting the error OverflowError: timestamp out of range for platform time_t. I'm relatively certain it's something with ...
0
votes
1answer
106 views

Raspberry Pi 4 to Mitutoyo Digimatic interface

I've been trying to interface a Mitutoyo digital caliper. I used the code from here and I think I made the right corrections according to the posters comments but as I checked he was last online in ...
1
vote
2answers
84 views

Use HC-SR04 Distance Sensor and Relay to trigger the Water Pump - Need help with triggering the pump

I am trying to trigger/stop a water pump with the use of a 4-channel relay and a UC-SR04 distance sensor. I tried with some codes but I think I am missing something because although there was no error ...
0
votes
0answers
57 views

picamera.exe.PiCameraIOError: Failed to write 291840 bytes from buffer to output <picamera.stream.BufferIO object at 0x62f70c60>

Using the PiCamera Advanced Recipies in the link I am trying to capture the image to a numpy array. My code basic lines of code are. final_image = np.empty((height , width , 3), dtype=np.uint8) ...
1
vote
0answers
31 views

PiGpio – pass through binary data

I have two ports connected to GPIO on a Raspberry, where I read and send data NMEA sentences to external equipment using the PiGpio library in python, and this is working fine. Now I need to transfer ...
0
votes
0answers
378 views

issues while installing scipy

I updated the python version to 3.7. While installing scipy using sudo apt-get install python-scipy it says python-scipy is already the newest version (1.1.0-7).. I also need a python package called ...
-1
votes
1answer
207 views

How to print list of availble networks and connect using python

I have been search for a couple of hours to find a a tutorial on how to show the list of available networks and connect to a network programmatically.I don't want to use command line. I have ...
0
votes
1answer
64 views

Raspberry3b, Python3, Combine 2 codes which work by themself (Thonny, Geany) but not together in the same IDLE

I have to combine two codes and run them one after the other. Unfortunately, I can't start the gps_receiver on Thonny_ide and neighter the other code on the default Geany_ide. Can somebody help me to ...
1
vote
1answer
74 views

lighting up LEDs from suricata security alerts

so I am a Python newbie attempting to write a script that will light up a different LED based on the priority level of the latest security alert added to a log file generated by the Suricata Intrusion ...
1
vote
1answer
50 views

Is there a motion/ location sensor for RPi/Python?

I'm currently working on a rough VR system using the Raspberry Pi 3, and, of course, for that, I need a way to track the custom headset and controllers. I need the sensors to be compatible with Python ...
1
vote
1answer
209 views

Error Installing TensorFlow on Rasperry Pi 3 B

I'm following this guide to create an AI chatbot which requires Python 3.6, tensorflow etc. So I installed Python 3.6.8. To install TensorFlow I tried sudo pip install tensorflow I also downloaded ...

1
2 3 4 5
8