Questions tagged [python-2.x]
To be used when a piece of code in a question is specifically related to any version of Python 2.
78 questions
-1
votes
1
answer
336
views
Downgrade Python 3 to python 2
I am running the new version (May'24) of Pi OS on my Pi Zero and Pi Nano.
The programmes I wish to run were written for python2 and am led to believe that this can be incompatible with Python3, so ...
0
votes
2
answers
112
views
Cronjob not executing when raspberry pi reboots
The following is the Python script that I want to execute every time Raspberry Pi reboots. When I run this Python script directly from the terminal it works. Not only does IP gets stored in the file ...
0
votes
0
answers
157
views
Python 2.7 and 3.x coexisting in harmony?
I'm on an RPi4 running the 64-bit version of Raspbian and want to have 2.7 and 3.x coexisting with NO problems. 3.x is part of the 64-bit Raspbian when installed. I just installed 2.7 (i.e., sudo apt ...
1
vote
2
answers
2k
views
Bullseye python2 RPi.GPIO
As I read from forums, Python2 is removal at bullseye. I install python2.7 manually but there is gpio problem with python2.
sudo python2.7 -m pip install RPi.GPIO
dont work. Raises
collect2: error: ...
0
votes
2
answers
114
views
How should I upgrade the version of Python to latest release [closed]
I would like to re-bind Apache fCGI to python3.7 instead of Python2.7. I saw the following error message while my script used type-hinting.
AH00163: Apache/2.4.38 (Raspbian) mod_fcgid/2.3.9 mod_wsgi/4....
0
votes
0
answers
77
views
imapclient is working fine when I run it by hand but not when I run it using cron
Currently, I have a python program where my pi will check if a certain email address has a certain email and then run another piece of code. When I run the script normally there is no issue with it, ...
2
votes
0
answers
4k
views
Updating python version3.6 to python 3.8.1
currently, my raspberry pi runs python versions 2.7 and 3.6 [by default] and version 3.8.1 [I'm trying to update the current version]
This causes a lot of trouble when I try to install a new package ...
1
vote
2
answers
337
views
Issues running Kivy and Flask together on Raspberry Pi 2 with touchscreen
Setup
Kivy 1.11.1
Flask 1.1.1
Python 2.7.13
Issue
I have an issue running together a Kivy app and Flask as thread on a RPi2 with a touchscreen. It is similar to the issue mentioned in this post ...
1
vote
1
answer
1k
views
Dash/Plotly webserver not working on raspberry Pi, working on mac
I am trying to chart real time data from a Raspberry Pi to a web server. In this case I am using dash (https://dash.plot.ly/live-updates) to do this. I am currently testing my dash web browser on ...
-1
votes
1
answer
567
views
Pigpio on callback get value
I currently have some code that I found that constantly outputs a value from a digital caliper. However, I want to modify this so that it is inside a function that can return that is returned from ...
0
votes
0
answers
130
views
capturing video stream using piCam
i'm trying to capture the video stream using piCam.
but i get this warning and the execution stops
this the code:
this the code I used:
import numpy as np
import cv2
cap = cv2.VideoCapture(0)
cap....
2
votes
3
answers
8k
views
Print PDF files using Python code
This Python code works in Windows but does not work in Raspbian. How do I print PDF files using the Raspberry Pi?
import os
fd = os.startfile("/home/pi/Desktop/a.pdf", "print")
0
votes
1
answer
1k
views
Cannot detect ttyS0 in python RPi3b+
I'm using the Rpi 3B+ and understand the hardware uart is used by the bluetooth.
I'm OK to use the other uart
I've followed several threads and believed I've done all I can.
Enabled the Uart in ...
0
votes
0
answers
370
views
Cannot install install tensor flow on raspberry pi 3b
i am running into an error when i try to install tensor flow using pip on my raspberry pi 3b+.
here is the error message:
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/...
0
votes
2
answers
414
views
Help running Python script from terminal as easily as I can with IDLE
I have a long script that runs several GPIO devices using both SMBus and pigpio. It starts a thread to cycle through a series of screens on an OLED display, and then connects to Paho MQTT, and keeps ...
3
votes
2
answers
35k
views
Installing Python 2.7
I am new to the Raspberry Pi, I have a project. I would like to work on Python 2 not Python 3.
By default Python 3 is installed on my Pi. I want to change or remove this version and I want to ...
-1
votes
1
answer
303
views
Adafruit_Nokia_LCD module on Raspberry Pi Zero W
I'm stuck with this Adafruit module. I was able to install without errors on a Pi2, but when I tried to replicate on my Zero W the installation goes fine but then I cannot import the module ("...
-1
votes
1
answer
162
views
SSH showing "connection failed" after installing "pip"
Python3, pip3 and python was installed before on my Raspberry Pi. Today I've successfully installed pip using below command:
sudo apt-get install python-pip
After few hours later I'm not able to ...
-1
votes
1
answer
679
views
Python script not accepting import function
I've been writing a simple python script, and I import the GPIO library, and the time library. I have the following code.
print()'Importing GPIO library'
import RPi.GPIO as GPIO
print()"Importing ...
2
votes
1
answer
3k
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 ...
0
votes
0
answers
96
views
Help with multiple inputs and responding to how long the inputs have been active
I'm using python 2.7.13 on a Raspberry Pi 3
The goal of my program is to send an email when an input is received (input goes low and I'm using software pull-ups) and then send out another email with ...
0
votes
1
answer
201
views
What does it mean and what are the reasons for when a RPi3 cannot find a service?
I have a RPi3 which can successfully trust, pair, connect and even list the service UUIDs of a BLE device both via bluetoothctl and via Bluepy python library.
But when it tries to 'get' that service ...
0
votes
0
answers
446
views
python 2.7 vs pyserial - no _port
I really have tried searching through all the forums. confusing.
The makers of Roboclaw wrote their test pythons scripts (and Roboclaw class) with Python 2.7. As of now, will NOT work with python v3.
...
1
vote
1
answer
170
views
Can't use libgpod in python on Zero W
I have installed python-gpod on Raspbian lite Stretch, but can't get it to work.
pi@raspberrypi:~$ uname -a
Linux raspberrypi 4.14.30+ #1102 Mon Mar 26 16:20:05 BST 2018 armv6l GNU/Linux
This ...
0
votes
2
answers
3k
views
Why would os.system('sudo pigpiod') fail silently, but only part of the time?
I'm trying to learn how to safely and reliably start and stop the pigipod DEOMON process from within a python script.
If pigpiod happens to be running already, then this script is always successful. ...