-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Script Command
sudo /home/pi/.pyenv/shims/python -m pip install --upgrade adafruit-python-shell click
git clone https://github.com/adafruit/Raspberry-Pi-Installer-Scripts.git
cd Raspberry-Pi-Installer-Scripts
sudo /home/pi/.pyenv/shims/python adafruit-pitft.py --display=28c --rotation=90 --install-type=console --reboot noOperating System
Raspberry Pi Trixie Lite (64-bit)
Hardware
Raspberry Pi Zero 2 W
Behavior
The adafruit-pitft.py script produces the following errors, including a fatal error in adafruit_shell.py:
/home/pi/Raspberry-Pi-Installer-Scripts/adafruit-pitft.py:632: SyntaxWarning: "\&" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\\&"? A raw string is also an option.
shell.pattern_replace("/etc/rc.local", "^.*fbcp.*$", "/usr/local/bin/fbcp \&")
/home/pi/Raspberry-Pi-Installer-Scripts/adafruit-pitft.py:635: SyntaxWarning: "\&" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\\&"? A raw string is also an option.
shell.pattern_replace("/etc/rc.local", "^exit 0", "/usr/local/bin/fbcp \&\\nexit 0")
/home/pi/Raspberry-Pi-Installer-Scripts/adafruit-pitft.py:741: SyntaxWarning: "\S" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\\S"? A raw string is also an option.
shell.pattern_replace(labwc_config, f"^{profile_name} {{([\S\s]*?)}}", f"{profile_name}: {{{profile_content}}}", multi_line=True)
/home/pi/Raspberry-Pi-Installer-Scripts/adafruit-pitft.py:744: SyntaxWarning: "\." is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\\."? A raw string is also an option.
shell.pattern_replace(labwc_config, f"(output {device_name}.*) scale [0-9](?:\.[0-9]+)?(.*)", r"\1\2")
/home/pi/Raspberry-Pi-Installer-Scripts/adafruit-pitft.py:975: SyntaxWarning: "\-" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\\-"? A raw string is also an option.
if shell.run_command("which systemctl", suppress_message=True) and shell.run_command("systemctl | grep '\-\.mount'", suppress_message=True):
Traceback (most recent call last):
File "/home/pi/Raspberry-Pi-Installer-Scripts/adafruit-pitft.py", line 867, in <module>
if shell.get_raspbian_version() == "bullseye":
~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/home/pi/.pyenv/versions/3.14.0/lib/python3.14/site-packages/adafruit_shell.py", line 655, in get_raspbian_version
if self.get_os() != "Raspbian":
~~~~~~~~~~~^^
File "/home/pi/.pyenv/versions/3.14.0/lib/python3.14/site-packages/adafruit_shell.py", line 635, in get_os
if self.run_command("command -v apt-get", suppress_message=True):
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pi/.pyenv/versions/3.14.0/lib/python3.14/site-packages/adafruit_shell.py", line 148, in run_command
err = read_stream(proc.stderr)
File "/home/pi/.pyenv/versions/3.14.0/lib/python3.14/site-packages/adafruit_shell.py", line 117, in read_stream
return output.read()
~~~~~~~~~~~^^
BlockingIOError: Read returned None.
Description
I am trying to configure a Raspberry Pi Zero 2 W to use the Adafruit 2.8" capacitive-touch LCD ( https://www.adafruit.com/product/2423 ), and I am following this guide:
https://learn.adafruit.com/adafruit-2-8-pitft-capacitive-touch/easy-install-2
My only deviation from those instructions is to accommodate my preference for pyenv over virtualenv. My setup script runs pyenv to install Python 3.14.0, and pyenv successfully builds it from source.
The main problem is this error:
File "/home/pi/.pyenv/versions/3.14.0/lib/python3.14/site-packages/adafruit_shell.py", line 117, in read_stream
return output.read()
~~~~~~~~~~~^^
BlockingIOError: Read returned None.
...which I have also seen in the Adafruit MAX98357A setup script. With the MAX98357A, the install appears to succeed and the part is usable after rebooting. But the same is not true for PiTFT Plus - after a reboot, the display remains unusable.
It is clear that this script requires a refresh anyway, given the error messages regarding the soon-to-be-deprecated incorrectly escaped strings.
Additional information
The problem is that the exception being raised (BlockingIOError) is not being caught by the except block that is looking only for TypeErrors. So a trivial fix to this problem, which enables the PiTFT setup script to complete, is to replace this at line 118:
except TypeError:
...with this:
except: