Stack Exchange Network

Stack Exchange network consists of 175 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.

5
votes
3answers
513 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 ...
5
votes
4answers
6k views

Do we need multiple versions of Python?

I am new to Linux and going through my installed folder I can see there are four different Python folders in the directory list. python python2.7 python3 python3.2 Do we need all the four versions ...
5
votes
2answers
6k views

I can't download PyCharm for Raspberry Pi 3

I have had my raspberry Pi 3b for a few months so I'm just getting used to it. I would however want to install PyCharm because I want to use my Pi to program on rather than my PC. Any ideas would be ...
5
votes
0answers
7k 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 ...
3
votes
1answer
54 views

Installing libraries via pip is taking forever. Raspberry pi 3b+

I tried to install scipy using pip3 install scipy as well as sudo pip3 install scipy and it got stuck at Building wheel for scipy for 45 minutes. Same is the case for cython. What is the fix or it ...
3
votes
2answers
4k 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 ...
3
votes
3answers
1k views

Is it ok to remove all Python?

I have a Raspberry Pi 3 Model B and I installed Raspbian on it using NOOBS. I want to use Python 3.6 only. Is it ok if I uninstall both Python 3.5 and 2.7? Will there be no system problems? If I yes, ...
3
votes
2answers
1k views

How to generate accurate PWM signals for many servos

I've ran into a bit of an issue with the Raspberry Pi's ability to generate accurate PWM signals for servos. My problem with this is that the servos jitter because of this lack of accuracy. Is there ...
3
votes
1answer
443 views

Capture image when camera is not covered

I am very new to R Pi, but I know my Python. I am working on a project where I have an always running camera, that is kept in dark. What I need to do is to capture an image when there is light. (lets ...
3
votes
1answer
561 views

Best Python 3.5 library for playing mp3 file on Raspberry pi 0 W

I've already tried VLC library but the cpu reach 100% usage frequently during file playing, I've also the necessity to track the state of the playing so to know when the file is ended etc., Any ideas?
3
votes
0answers
260 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 ...
3
votes
1answer
5k views

Python script fails with 'ImportError' when run from rc.local

So I've tested that my script does attempt to run and I'm recording the error message of Traceback (most recent call last): File "/home/pi/steamFriendStatus_v0.3.py", line 6, in <module> ...
2
votes
2answers
495 views

How does Raspbian know it's been installed in a Pi or Compute Module?

I want to design a python script that would allow me to check whether it's currently in a standard Pi 3 or it's in a Compute Module 3. But I have no idea even on how Raspbian OS know itself is ...
2
votes
3answers
2k 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 ...
2
votes
2answers
11k views

How to connect MySQLdb in Python 3?

I want to connect MySQLdb with Raspberry Pi. But when running my program, I get this error: $ sudo python3 readMQ2sql.py Traceback (most recent call last): File "readMQ2sql.py", line 17, in <...
2
votes
1answer
729 views

Is there a problem with using deprecated os.popen?

I'm using os.popen() to run terminal commands in multiple projects. I keep reading that os.popen() is deprecated though and I should use Popen() instead, but I haven't been able to get Popen() to ...
2
votes
2answers
2k 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 ...
2
votes
1answer
466 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
2answers
5k views

Pip3 install throwing error on raspberry pi 3 Raspbian-Jessie

I am trying to install a python 3 library on a raspberry pi 3 running Raspbian-Jessie. sudo pip3 install LIBRARY However, regardless of what library I try to install, I am getting this error: ...
2
votes
1answer
3k views

Saving graphs using Matplotlib is very slow

I am trying to write a python Code snippet which creates 24 figures and 9 subplot and saves them in the directory. Its taking around 197 sec to create all the 24 figures and save them. This is ...
2
votes
1answer
39 views

Use matplotlib on Raspbberrypi

Using The following Code for saving plot locally on raspberry: from numpy import genfromtxt import matplotlib.pyplot as plt import plotly.io as pio y = range(10) x = range(10) plt.title("Adc data") ...
2
votes
1answer
4k 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 ...
2
votes
1answer
50 views

Installation of opencv-contrib-python through pip3 fails

I typed the code pi@raspberrypi:~ $ pip3 install opencv-contrib-python it responded with "Collecting opencv-contrib-python" Could not find a version that satisfies the requirement opencv-contrib-...
2
votes
1answer
74 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 ...
2
votes
1answer
2k views

Found a PyPi Package for Opencv-contrib, but can't install using pip

I'm trying to install OpenCV for python with extra modules on my raspberry pi. The OpenCV website has a set of instructions that I have tried with different variations for the past several months. I ...
2
votes
0answers
318 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 ...
2
votes
0answers
571 views

Enabling I2C resulting in error Raspberry Pi

I am trying to use MPU 6050 on raspberry pi. For that I enabled i2c on raspi. But after that whenever I am trying to check the modules on my Python 3 or 2 shell for e.g. when I run help('modules'), I ...
2
votes
0answers
1k views

Segmentation fault, running out of memory? PyQt5

I am programming code to display camera feed with my raspberry pi 3 and Raspbian. Strangely, sometimes the code shows the video and sometimes i get the Segmentation fault error. I used gdb to find ...
2
votes
0answers
4k views

Want to Read COM Port Data and Write into TKinter Text Window

Using Python3, I want to read data on a serial port and display it into a tkinter GUI text window (not only the shell). Pretend I am trying to make the equivalent of a serial port character display. ...
1
vote
3answers
66 views

Self-balancing robot using Raspberry 3b+

I have built a self balancing robot using raspberry pi 3b+. I am not able to reduce the response time. Hence, the robot doesn't balance properly. I am using MPU 6050, 150rpm 12V DC motor. I checked ...
1
vote
2answers
1k 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 ...
1
vote
2answers
163 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 ...
1
vote
2answers
969 views

WiFi Interfacing using Python

I am building a Smart Mirror for a school project and I need a way to give the user an interface where they can search and connect to a network. Unfortunately, my Raspberry Pi stopped working (doesn’...
1
vote
3answers
887 views

UART problem: Sending more than 8 bits

How can I send something more than 8 bits over UART? Any python libraries?
1
vote
1answer
63 views

Access wpa_supplicant inside docker

How can I access wpa_cli inside a docker? I want to connect to wifi from inside a docker in Pi 3. For that I am using wpa_cli. But when I run wpa_cli inside the docker I get following error: Could ...
1
vote
1answer
37 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 ...
1
vote
1answer
87 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 ...
1
vote
2answers
476 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
220 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
154 views

Problem with packages [closed]

I'm trying to compile my code import sys,os sys.path.insert(0, '/usr/include') sys.path.append('/usr/include') import plivo, plivoxml auth_id = "Your AUTH_ID" auth_token = "Your ...
1
vote
1answer
284 views

python.exe file not found; creating “virtual environment”

Aim: Build projectoxford into raspberrypi3 - https://channel9.msdn.com/Blogs/jsturtevant/Setting-up-Project-Oxford-for-Python-on-Windows At 2:11 of the video, for windows, the command used to create ...
1
vote
1answer
344 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 ...
1
vote
1answer
2k 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. ...
1
vote
2answers
125 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 ...
1
vote
2answers
157 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 ...
1
vote
1answer
370 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
1answer
1k 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 ...
1
vote
1answer
154 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 ...
1
vote
2answers
79 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
506 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 ...