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.

600 questions
16
votes
6 answers

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 running into this error when running my script followed…
Justin
  • 452
  • 1
  • 4
  • 13
14
votes
2 answers

Updating Python 3.7 to 3.8 on Raspberry Pi

I recently updated my Raspberry Pi with sudo apt update and sudo apt full-upgrade to the system. Even if Python 3.8 is out, when I run python3 in terminal, it shows me version 3.7, instead of 3.8. Why is this the case?
Macintosh Fan
  • 368
  • 2
  • 3
  • 15
12
votes
3 answers

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 worried is too fast for the Pi (I need 8 pins toggled).…
auden
  • 253
  • 1
  • 2
  • 11
11
votes
0 answers

How to install Python 3.7 with SSL?

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 upgrade $ sudo apt-get dist-upgrade $ sudo apt-get install…
swizzlevixen
  • 313
  • 1
  • 2
  • 12
11
votes
2 answers

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 import telepot ImportError: No module named…
Purdy
  • 113
  • 1
  • 1
  • 4
8
votes
1 answer

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 just takes that long. numpy and other libraries like…
Tanmay Bhatnagar
  • 193
  • 1
  • 2
  • 6
7
votes
2 answers

I want to run a Python 3 script on startup and in an endless loop on my Raspberry Pi

I have created a smart vending machine using my Raspberry Pi. For now, I open the Raspberry Pi using SSH and run the script manually for every transaction. I want to automate the process and run the script on startup. After execution I want it to…
Adnan Farooqui
  • 111
  • 2
  • 8
7
votes
2 answers

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 file: no such file or directory I have tried sudo…
JohnConstantine
  • 71
  • 1
  • 1
  • 3
6
votes
2 answers

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 connection is possible, and Magic + reisub doesn't work,…
Hemanti
  • 73
  • 1
  • 1
  • 5
6
votes
1 answer

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 implemented Raspberry Pi 3. How could I optimize the…
code_slack
  • 61
  • 1
  • 1
  • 4
6
votes
4 answers

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 or should I remove the others and keep only the…
SteveIrwin
  • 1,710
  • 2
  • 18
  • 31
6
votes
3 answers

How to automatically rerun Python script if error occurs

I have a Python script which ideally runs indefinitely in a loop. I am catching some exceptions, however, the problem is when some error occurs and the script stops because of that error. I want to detect somehow this situation and restart the…
PostarLakogSna
  • 91
  • 1
  • 1
  • 9
5
votes
4 answers

Launch a GUI Tkinter program on boot

I am trying to auto launch a Tkinter/Python program when the Raspberry Pi boots up. Ideally I would like to boot the Pi into the console and then launch a GUI Tkinter Python program. In testing – not sure if this is possible? The second best option…
dkuzdas
  • 59
  • 1
  • 1
  • 2
5
votes
1 answer

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. This seemed to work several times (maybe it was…
King Balloonion
  • 173
  • 1
  • 2
  • 14
5
votes
3 answers

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 so that if something goes wrong (like if one of…
StarSweeper
  • 455
  • 3
  • 12
1
2 3
39 40