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.

5
votes
3answers
461 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
4k 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 ...
3
votes
2answers
2k 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
975 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
410 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
520 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
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 ...
3
votes
1answer
4k 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
480 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
1k 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
9k 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
612 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
876 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
260 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
2k 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
3k 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
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 ...
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
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 ...
2
votes
0answers
258 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
504 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
3k 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
2answers
646 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
98 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
846 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
805 views

UART problem: Sending more than 8 bits

How can I send something more than 8 bits over UART? Any python libraries?
1
vote
2answers
4k 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: ...
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 ...
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 ...
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
2answers
69 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
136 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
240 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
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 ...
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. ...
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 ...
1
vote
2answers
99 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
253 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
884 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
105 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
1answer
367 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
vote
5answers
5k views

How do I connect GSM SIM 900A to a Raspberry Pi 3?

I want to connect the GSM SIM 900A to a Raspberry Pi 3 but I don't where the problem is. I used this configuration: https://qph.fs.quoracdn.net/main-qimg-c124f9e741afd438969e869e52d0df6b Then I ...
1
vote
1answer
2k views

Scan and Retrieve List of Bluetooth Devices Using Python 3

When using the terminal inside the Raspberry pi, i have to use only 3 commands to retrieve a list of Bluetooth capable devices in the area. These are the commands that are executed in order: "sudo ...
1
vote
1answer
535 views

Cannot import patterns; workaround doesnt work either

Aim: Build projectoxford into raspberrypi3 - https://channel9.msdn.com/Blogs/jsturtevant/Setting-up-Project-Oxford-for-Python-on-Windows I have reached the steps of: pi@raspberrypi:~/happy-image-...
1
vote
1answer
2k views

Problem with matplotlib

I am attempting to run some matplotlib tutorials on my Pi3 running Raspbian Stretch. I have installed matplotlib & numpy using pip3 When trying to run any of the tutorials I get an error ...
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 ...