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
1answer
67 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
418 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 ...
1
vote
2answers
289 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....
7
votes
0answers
12k 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
217 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 ...
2
votes
3answers
3k views

Reinstalling Python3

I purged all the python3 packages and when I try to install python3 again on my raspbian I get this: Setting up python3.5-minimal (3.5.3-1) ... # Empty sitecustomize.py to avoid a dangling symlink ...
1
vote
2answers
296 views

Raspberry Pi DC Motor Not Working

So, I am attempting to control a DC motor using a RPi Model 2B. I am using a l293d motor driver to try to control the motor and a 4 AA battery holder. The diagram is supposed to look like this ...
3
votes
2answers
5k views

How fast can GPIO pins toggle?

I'm currently using Python's RPi.GPIO module to toggle some pins, and I want to know how quickly it can do this. I need the pins to be toggled on the schedule of a ~50 mhz FPGA clock, which I'm ...
1
vote
2answers
274 views

Raspberry Pi Error: AttributeError: module 'l293d.driver' has no attribute to 'motor'

So, I am trying to use my RPi model 2B to control a DC motor with an l293d controller. I have moved onto the python3 script and imported the 'l293d' module. Here is my code... import l293d.driver ...
0
votes
1answer
732 views

Help with choosing a GUI library for RPI developpement

I am currently coding an app for Raspberry Pi, the app is very GUI dependent. During my research i saw online that tktinker is good for small/simple apps. I got really excited for PyQt but found out ...
-1
votes
2answers
231 views

Reverse DNS on internal LAN

Writing a Python program for my PiZeroW to scan and inventory my home local, internal network. I can easily iterate though the 256 internal DHCP available IP addresses (some assigned, some not), but ...
1
vote
1answer
575 views

Picamera capture to array is slow

In python module picamera, does anyone noticed that camera.capture(array, 'rgb') is quite slow?? If you try to measure this time is about 540ms... example code (the "real code" is irrelevant): from ...
1
vote
0answers
227 views

Send data BMP180 between client and server trought module socket

I would like to send data of BMP180 sensor between a client and a server with two raspberry pi 3 being that the client when executing the command get the server will give the temperature value to the ...
0
votes
1answer
361 views

Why does a communication over SPI returns garbage?

I am trying to read from a gps module NEO-6M using Raspbery Pi 3 B over SPI. It nicely works with Arduino but it doesn't want to work with Raspberry. I have used different libraries in Pyhon, even ...
0
votes
1answer
476 views

Get measured value of gpio vibration sensor (SW420)

I've managed to connect 2 SW420 vibration sensors to my rpi3 and can identify a vibration event on callback. However, I'd like to get the measured value (voltage change?) from the sensors, to see ...
2
votes
1answer
757 views

Python 3 interpreter not recognizing a new installed package(python 3.5.3)

I'm new to this RPI world and also to python although I completed the basic courses I'm still getting used to this so I will appreciate your patience I'll try to express my self the best way. I ...
2
votes
1answer
3k views

Raspberry Pi 3B+ freezes randomly

General setup My RPi is connected to a mouse, keyboard, and monitor. My swap size is set to 1000 MB and I'm not using wifi. Problem The RPi freezes randomly, meaning the GUI is frozen, no SSH ...
0
votes
1answer
70 views

Cron Job turns off the matrix MAX7219 after finishing the script

I have a script in python3 which executes and shows information in an 8x8 MAX7219 matrix and works perfectly. When I run the script directly from the .py file, the matrix does not turn off (and that's ...
1
vote
2answers
15k views

pip cannot confirm SSL certificate: SSL module is not available

I am trying to install openCv for Python 3.6 on my Raspberry Pi 3 Model B+, but somehow it won't connect to the python.org website. I have pip installed for 2.7, 3.0, and 3.6 installed, so when I go ...
0
votes
1answer
418 views

How can I connect with my Raspberry Pi to a database on my PC server using wifi?

Connection code: db = pymysql.connect("192.168.137.1:5901","root","","the-data-base") cursor=db.cursor() Result: Traceback (most recent call last): File "adc.py", line 17, in <module> ...
1
vote
3answers
1k views

Raspberry Pi won't recognize nRF24L01+

I'm a Raspberry Pi n00b and a python beginner, but I have a lot of experience with DIY electronics, arduino and c#. I've tried everything I can think of, and I just can't get the Pi to recognise the ...
2
votes
0answers
451 views

Difference between Thonny and Python 3 (running some code)

I'm just starting with the pi and to be more clear I'm spending time working with the Raspberry Pi Workshop for Beginners series on Youtube.To write an run code we use the Python 3 IDE but I don't ...
0
votes
1answer
102 views

I am trying to create a HID that controls the up and down arrow keys with the raspberry pi

I am trying to create a HID that controls the up and down arrow keys with the raspberry pi. I don't know the simplest/best way to connect the pi to pc for live data exchange. My idea is that the pi ...
0
votes
1answer
180 views

Need assistance hooking up Sharp GP2Y0A41SK0F IR sensor

So I have this... Infrared Proximity Sensor Short Range - Sharp GP2Y0A41SK0F & 1 MCP3002. I have been scouring the web for hours, trying all code examples and I still get 0 as a reading no matter ...
1
vote
1answer
255 views

Setting up automatic submersible pump and moisture sensor

I recently came up with the idea of using a raspberry pi to power and control a moisture sensor and a pump to automatically water a plant. It's nothing large scale, but I want it to automatically ...
0
votes
0answers
164 views

Motor driving using template matching using python and opencv on Rapberry pi

I want to drive a motor when my template is matched, I have written code of template matching but can't figure out how to drive the motor with it. This is my code: import cv2 import numpy as np ...
1
vote
2answers
2k views

Raspberry pi no module named socket server

I have a strange raspberry pi issue. When I run a python code manually it works perfect but when I run it during startup it gives this error no module named socket server. This is the code given below ...
0
votes
1answer
127 views

PyQt5 / eglfs: Draw call returned Cannot allocate memory. Expect corruption

Rather sure this is not a PyQt specific question, but that's the context. When attempting to start a PyQt5 from CLI/text mode into eglfs, I am met with the following errors: QOpenGLFramebufferObject:...
0
votes
1answer
197 views

mqtt on rpi zero w

I have rpi zero w system with below spec. system specifications: micro SD card slot, a mini HDMI port, two micro USB ports (one for power, one for USB), and 512MB of RAM. It has a single-core 700 MHz ...
0
votes
1answer
247 views

Only 1 thread starts when multi-threading in Python 3 [closed]

t2.start, (the last line), does not execute until I press CTRL+C. Why is this the case? import threading from time import sleep def thread1(): try: while True: print("Thread1 ...
0
votes
1answer
528 views

Running a camera script on startup - Raspberry Pi Zero W

I'm creating a time-lapse camera to attach to a pair of glasses. I tried out my script (python 3) and it works, but I need to get my script to work upon startup up since it will powered by a ...
0
votes
1answer
363 views

TCP server on raspberry pi not connecting to android tcp client [closed]

I am creating a TCP server on raspberry pi so that i can control it from my android phone over WIFI. I have connected both the pi and the phone to my WIFI router. import socket from cookieLED_FINAL ...
0
votes
1answer
805 views

Running my python 3 code on startup with systemd - permission denied

I have a python script which uses motion sensor and camera. It captures an image and stores to the same folder where the script resides. No errors when I run it in bash. But I created this service for ...
0
votes
1answer
243 views

Cannot execute Python3 RPi.GPIO import from shell/rc.local

I have a python script with import RPi.GPIO as GPIO. When I execute in my Raspberry Pi3 Python3 IDLE, it runs just fine with no issues. If I launch the script with shell pi@my_user_name, it says "no ...
-1
votes
1answer
553 views

How can capture many images using picamera and loop and different name? [closed]

Here's my current Python code: import picamera with picamera.piCamera() as camera: for i in range (10): camera.capture("/home/pi/Desktop/newfile/newimage.jpg")
1
vote
1answer
168 views

Camera pretrigger capture

Hi i want to make a program that will continually record a video and on a press of a button, it will save 2 minutes before i pressed the button is it possible to do it somehow ?
0
votes
1answer
458 views

Does there exist an mqtt client that works with python 3.5 on raspbian stretch?

I have been using the paho-mqtt client successfully with python 2.7 on raspbian stretch, but I have a need to use python 3.5 on a new project and paho-mqtt does not appear to install or build for that ...
1
vote
2answers
110 views

Get photoresistor working with Python3

I have a Python 3 program but the code below doesn't work in Python 3. I've searched for days but didn't find any solution. Is there any way to get this working in Python 3? The only output I get is ...
1
vote
1answer
265 views

How to programmatically check bluetooth speaker is connected to rpi3?

I am trying to detect if my bluetooth speaker is connected to my rpi3 with my python code, executing this command status = subprocess.call('ls /dev/input/event0 2>/dev/null', shell=True) if the ...
2
votes
1answer
6k views

How can I use OpenCV with Python 3 on a Raspberry Pi?

I have installed OpenCV and and access it with Python 2. However, I'm unable to use OpenCV with Python 3. It says "Cannot open shared object". ImportError: libQTtest.so.4: cannot open shared object ...
3
votes
2answers
7k views

Failed to create MMAL component b'vc.ril.camera': Out of memory

I am trying to run a simple script that listens for a button click and then takes a picture. Once two pictures have been taken it compares the two using OpenCV to calculate the difference. I am ...
0
votes
1answer
207 views

I'm wanting to get user input from a screen, but I can't have any buttons

I'm developing an python3 application that only uses a handheld scanner for input. I need to prompt the user for input and want to use a nice window to do it. When I look at tkinter, it appears that ...
1
vote
0answers
561 views

usb.core.USBError: [Errno 13] Access denied (insufficient permissions)

I am running Rasbperry pi and have the pyusb module installed. The printer is Bus 001 Device 004: ID 0fe6:811e Kontron (Industrial Computer Source / ICS Advent) Parallel Adapter, and it's idVendor and ...
5
votes
3answers
657 views

Is it necessary to release Raspberry Pi Camera before rebooting? If so how do I do it?

I have a python3 script that uses OpenCV and a Raspberry Pi cam. It runs almost 24/7. Using crontab the pi will reboot every night at midnight and the script will begin running again. This is mostly ...
0
votes
1answer
99 views

WIFI Configuration Before Complete Boot-up Of Pi

I am making a program and I need this program to get WIFI Credentials before anything else. Kind of like when you buy an Alexa and it has you connect to the internet before you can do anything with it....
-1
votes
1answer
20 views

The data has being rotating left by one bit, each time when I read the data [closed]

am interfacing EM-18 rfid reader to raspberry pi 3 through USB. The data has being rotating left by one bit, each time when I read the data
0
votes
2answers
331 views

Raspberry pi: Arduino to Python

my group and I are interfacing Arduino and python on our Raspberry pi zero w so that an IR receiver connected to the Arduino sends the corresponding characters to python, which it does.However, we are ...
0
votes
1answer
1k views

No module named PiCamera

Trying to run a python program in a vm (virtual environment) with the picamera module, i'm running it in the vm because i have other modules there like OpenCV. When running the program i get the error:...
1
vote
1answer
638 views

import error - matplotlib

I'm kind of new to RPi. I need to plot a data stream received on some of GPIO pins. I've decided to use matplotlib for the project. however I'm stuck at stage 1: install and import matplotlib! I've ...
-1
votes
1answer
178 views

IR sensor program will not run

When I run it nothing happens either in command prompt or the shell. I think I am missing some code line but I got it from a online project and cant ferret out the problem This code is supposed to ...