Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adafruit-pitft.py boot_dir #338

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mikeysklar
Copy link
Contributor

@mikeysklar mikeysklar commented Mar 9, 2025

fix for /boot/firmware vs /boot logic for the config.txt location

A recent change to adafruit-pitft.py is causing this error message on Pi OS Bookworm systems Pi3B and Pi4B confirmed. Likely all models are effected when setting up a TFT display on Bookworm.

PITFT Updating /boot/firmware/config.txt/config.txt...
Traceback (most recent call last):
  File "/home/pi/Raspberry-Pi-Installer-Scripts/adafruit-pitft.py", line 944, in <module>
    main()
  File "/home/pi/env/lib/python3.11/site-packages/click/core.py", line 1161, in __call__                                                                                    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pi/env/lib/python3.11/site-packages/click/core.py", line 1082, in main    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/pi/env/lib/python3.11/site-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pi/env/lib/python3.11/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pi/Raspberry-Pi-Installer-Scripts/adafruit-pitft.py", line 892, in main
    if not update_configtxt(tinydrm_install=(not is_bullseye)):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pi/Raspberry-Pi-Installer-Scripts/adafruit-pitft.py", line 431, in update_configtxt
    shell.write_text_file(f"{boot_dir}/config.txt", """
  File "/home/pi/env/lib/python3.11/site-packages/adafruit_shell.py", line 475, in write_text_file
    with open(self.path(path), mode, encoding="utf-8") as service_file:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
NotADirectoryError: [Errno 20] Not a directory: '/boot/firmware/config.txt/config.txt'

Easy work around is to hand specify boot_dir:

--boot=/boot/firmware
 sudo -E env PATH=$PATH python3 adafruit-pitft.py --display=28c --rotation=90 --install-type=console  --boot=/boot/firmware

This code just puts in some safety checks and does not rely on shell.get_boot_config() which was problematic. Tested and confirmed to work on Bookworm, 64-bit, Lite, Pi 4B, 2.8c display.

Forum issue for reference.

fix for  /boot/firmware vs /boot logic for the config.txt location
@mikeysklar
Copy link
Contributor Author

@makermelissa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant