txoof / PaperPi

E-Paper display loop with plugins
100 stars 10 forks source link

Crash on startup #145

Closed txoof closed 8 months ago

txoof commented 10 months ago

raspberry pi 3b+ with full 32 bit os install. The screen is 4.2 inch waveshare (epd4in2b_V2). After running the program, the following comes up on the terminal.

pi@raspberrypi:~ $ sudo /usr/local/bin/paperpi
14:53:47 paperpi :get_config_files:256 :INFO       - using configuration files to configure PaperPi: [PosixPath('/usr/local/paperpi/config/paperpi.ini'), PosixPath('/root/.config/com.txoof.paperpi/paperpi.ini')]
14:53:47 paperpi :main      :658 :INFO       - ********** PaperPi 0.5.4.1 RGB Starting **********
14:53:47 paperpi :main      :662 :INFO       - PaperPi is running in on-demand mode
14:53:47 Block   :padding   :367 :WARNING    - padding value is greater >= 1/2 of area dimension 1, no image will be displayed: 10
14:53:47 Block   :padding   :367 :WARNING    - padding value is greater >= 1/2 of area dimension 1, no image will be displayed: 10
14:53:47 Block   :padding   :374 :WARNING    - the padded area available may be too small to display any content: Area: (1, 1), Padded Area: [-19, -19]
14:53:47 Block   :font_size :852 :WARNING    - no font size set, using {font_size}
Traceback (most recent call last):
  File "/usr/local/paperpi/paperpi.py", line 738, in <module>
    exit_code = main()

File "/usr/local/paperpi/paperpi.py", line 693, in main
    splash = setup_splash(config, screen.resolution)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/paperpi/paperpi.py", line 407, in setup_splash
    splash = Plugin(**splash_config)
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/paperpi/library/Plugin.py", line 119, in __init__
    self.layout = layout
    ^^^^^^^^^^^
  File "/usr/local/paperpi/library/Plugin.py", line 310, in layout
    self.layout_obj = Layout(resolution=self.resolution,
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/paperpi/venv_paperpi/lib/python3.11/site-packages/epdlib/Layout.py", line 80, in __init__
    self.layout = layout
    ^^^^^^^^^^^
  File "/usr/local/paperpi/venv_paperpi/lib/python3.11/site-packages/epdlib/Layout.py", line 62, in new_f
    return f(self, *args, **kwds)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/paperpi/venv_paperpi/lib/python3.11/site-packages/epdlib/Layout.py", line 127, in layout
    blocks[name] = self.set_block(name, values)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/paperpi/venv_paperpi/lib/python3.11/site-packages/epdlib/Layout.py", line 165, in set_block
    block = getattr(Block, values['type'])(**values)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/paperpi/venv_paperpi/lib/python3.11/site-packages/epdlib/Block.py", line 824, in __init__
    self.font = font
    ^^^^^^^^^
  File "/usr/local/paperpi/venv_paperpi/lib/python3.11/site-packages/epdlib/Block.py", line 51, in new_f
    return f(self, *args, **kwds)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/paperpi/venv_paperpi/lib/python3.11/site-packages/epdlib/Block.py", line 885, in font
    self._font = ImageFont.truetype(str(Path(font).resolve()), size=self.font_size)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/paperpi/venv_paperpi/lib/python3.11/site-packages/PIL/ImageFont.py", line 797, in truetype
    return freetype(font)
           ^^^^^^^^^^^^^^
  File "/usr/local/paperpi/venv_paperpi/lib/python3.11/site-packages/PIL/ImageFont.py", line 794, in freetype
    return FreeTypeFont(font, size, index, encoding, layout_engine)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/paperpi/venv_paperpi/lib/python3.11/site-packages/PIL/ImageFont.py", line 226, in __init__
    self.font = core.getfont(
                ^^^^^^^^^^^^^
OSError: invalid ppem value
selsarkin commented 10 months ago

Thanks for your reply Aaron. I have 3 screens. 2.13inch (epd2in13b_V4) 2.7inch(epd2in7b_V2) 4.2inch(epd4in2_V2 Here are os details and the paperpi.ini pi@raspberrypi:~ $ cat /etc/os-release

PRETTY_NAME="Raspbian GNU/Linux 12 (bookworm)"
NAME="Raspbian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

paperpi.ini

# CONFIG_VERSION=1.2
[main]
# waveshare display type use HD for IT8951 displays
display_type = epd2in7b_V2
# required vcom value for IT8951 screens
vcom = 0.0
# maximum refresh between total screen clear for HD displays
max_refresh = 4
# logging output level
log_level = WARNING
# display splash screen (True or False)
splash = True
# rotation of EPD display 
# (cable bottom: 0; cable left: -90; cable right: 90; cable top: 180)
rotation = 0
# mirror screen outuput - useful if output to screen appears backwards
mirror = False
# do not wipe screen when shutting down. True: leave image; False: wipe screen (default)
no_wipe = False
# plugin timeout - amount of time in seconds to wait for a hung plugin to complete execution
plugin_timeout = 30

##### PLUGINS #####
# Each plugin must be configured. A plugin can be
# included multiple times with different configurations
# e.g. to show the status of multiple Logitech Players, or
# weather in multiple locations or with different layouts

# find a list of available plugins:
# $ paperpi --list_plugins

# active plugins configurations must include:
# [Plugin: Your Name For This Plugin] # must start with "Plugin: "
# layout = name_of_layout # found in plugins/plugin_name/layout.py
# plugin = plugin_name # found as plugins/plugin_name
# refresh_rate = seconds # number of seconds between updates to *data*
# min_display_time = seconds # minimum time plugin should show when active
# max_priority = int # values closer to 0 are high priority, negative values are ignored

# use `paperpi --plugin_info [plugin_name]` for a sample configuration and
# available layouts

# Fallback, default plugin to display if all else fails
[Plugin: default fallback plugin]
layout = layout
plugin = default
refresh_rate = 30
min_display_time = 60
max_priority = 2**15

[xPlugin: System Info]
# show basic facts about the system including IP, Hostname, CPU usage, temperature and storage
# default layout
layout = layout
# the literal name of your module
plugin = system_info
# recommended display time
min_display_time = 45
# maximum priority in display loop
max_priority = 2
# storage units in decimal: [KB] KiloByte 10^3; [MB] MegaByte 10^6; [GB] GigaByte 10^12; [TB] TeraByte 10^12
storage_unit = GB
# colors for RGB screens
text_color = BLUE
bkground_color = WHITE

[xPlugin: A Demo Plugin]
# this is a sample config users can use to help setup the plugin
# default layout
layout = layout
# the literal name of your module
plugin = demo_plugin
# recommended display time
min_display_time = 30
# maximum priority in display loop
max_priority = 1
# your name
your_name = Slartybartfast
# your favorite color
your_color = chartreuse

[xPlugin: New Yorker Comic]
layout = layout
plugin = newyorker
day_range = 5 # number of past days to choose from
refresh_rate = 120
min_display_time = 60
max_priority = 2

[xPlugin: Reddit Quotes]
layout = layout
plugin = reddit_quote
refresh_rate = 100
min_display_time = 50
max_priority = 2
# maximum length of quote (in characters) including spaces, a la Twitter
max_length = 144
# Text/background color [RED, ORANGE, YELLOW, GREEN, BLUE, BLACK WHITE] or random
# bkground color is not supported in this plugin 
# text_color = RED
# bkground_color = random

[xPlugin: Word Clock]
layout = layout
plugin = word_clock
refresh_rate = 125
min_display_time = 255
max_priority = 2
# Text color [RED, ORANGE, YELLOW, GREEN, BLUE, BLACK WHITE] or random
# text_color = random
# bkground_color = random

[xPlugin: Weather Adis Ababa]
layout = layout
plugin = met_no
refresh_rate = 300
min_display_time = 50
max_priority = 2
location_name = Adis Ababa
lat = 9.000
lon = 38.750
# this is required by Met.no -- please use a real value
email = you@host.diamond
# Text color [RED, ORANGE, YELLOW, GREEN, BLUE, BLACK WHITE] or random
# bkground color is not supported in this plugin 
# text_color = BLUE 

[xPlugin: default fallback plugin]
layout = layout
plugin = default
refresh_rate = 30
min_display_time = 60
max_priority = 2**15

[xPlugin: XKCD Comic Plugin]
# default layout
layout = layout
plugin = xkcd_comic
refresh_rate = 1200
min_display_time = 120
# maximum x dimension of comic image
max_x = 800
# maximum y dimension of comic image
max_y = 600
# max attempts to find a suitable comic image
# 0 do not rsize small comics / 1 maximize small comics to max_x, max_y
resize = 0
max_retries = 10
max_priority = 2

[xPlugin: Librespot]
layout = layout
plugin = librespot_client
refresh_rate = 10
max_priority = 0
min_display_time = 15
# name of librespot player
player_name = SpoCon-Spotify
# time in seconds before plugin is removed from the display loop
idle_timeout = 10

[xPlugin: Slideshow]
# default layout
layout = layout
plugin = slideshow
# time between choosing new image (seconds)
refresh_rate = 90
# recommended display time (seconds)
min_display_time = 50
# maximum priority in display loop
max_priority = 2
# path to image directory
image_path = /pi/documents/images
# order to pull images in: random, sequential
order = random
# frame style to use (see README)
frame = black & silver: matted

[xPlugin: LMS - Your Player Name]
layout = layout
plugin = lms_client
player_name = Your Player Name
refresh_rate = 5
min_display_time = 30
max_priority = 0
idle_timeout = 15

[xPlugin: decimal binary clock]
layout = layout
plugin = dec_bin_clock
refresh_rate = 30
min_display_time = 50
max_priority = 2

[xPlugin: Moon Phase]
# default layout
layout = layout
plugin = moon_phase
min_display_time = 30
max_priority = 2
refresh_rate = 1200
# your email address for MET.no API access -- failure to specify may lead to a perma-ban
email = you@host.diamond
# Timezone locale name in Region/City format (see --run_plugin_func moon_phase.list_country_locales)
# Use a known city in your timezone; this is critical for calculating the moonrise time
location_name = Europe/Amsterdam
# lat/lon of your physical location (optional) (see --run_plugin_func moon_phase.get_coord)
lat = 52.3
lon = 4.9

[xPlugin: Crypto Bitcoin v USD]
plugin = crypto
layout = layout
# fiat currency to use for comparison
fiat = usd
# crypto currency to track
coin = bitcoin
# days of data to display
days = 14
# interval to show on sparkline
interval = hourly
# rss news feed to display
rss_feed = https://bitcoinmagazine.com/.rss/full/
min_display_time = 60
# refresh data every 5 minutes
refresh_rate = 300
max_priority = 2

[xPlugin: Basic Clock]
layout = layout
plugin = basic_clock
refresh_rate = 30
min_display_time = 50
max_priority = 2
txoof commented 10 months ago

Your config looks ok. I suspect this has something to do with how the 2in7b reports its resolution. I'll need to dig into that later when I have a bit more time.

One more useful thing: can try paperpi -l INFO and share the output up to the crash?

txoof commented 10 months ago

@selsarkin Can you also share the output of these commands:

ls -alh /usr/local/paperpi and ls -alh /usr/local/paperpi/fonts

ALSO Can you tell me how you installed paperpi? Did you use the remote install script, cloned repo and ran install, etc?

The error indicates that PaperPI failed to load fonts. Maybe the installer went off the rails and failed to copy fonts. That, or the permissions are totally borked.

txoof commented 10 months ago

looks like the waveshare epd driver may be having issues:

  File "/usr/local/paperpi/waveshare_epd/epdconfig.py", line 71, in module_init
    self.GPIO.setup(self.RST_PIN, self.GPIO.OUT)
RuntimeError: No access to /dev/mem.  Try running as root!

This should not happen.

Not sure why the underlying waveshare modules are demanding root access. there's clearly something deeper at work here in Bookworm.

I'll keep diging.

selsarkin commented 10 months ago

The install was done going through your step by step instructions page.

pi@raspberrypi:~ $ ls -alh /usr/local/paperpi total 72K drwxr-xr-x 9 pi pi 4.0K Dec 14 12:01 . drwxr-xr-x 11 root root 4.0K Dec 14 11:51 .. drwxr-xr-x 2 pi pi 4.0K Dec 14 11:45 config -rw-r--r-- 1 pi pi 234 Dec 14 11:45 debian_packages-paperpi.txt drwxr-xr-x 15 pi pi 4.0K Dec 14 11:45 fonts drwxr-xr-x 3 pi pi 4.0K Dec 14 12:01 library -rw-r--r-- 1 pi pi 938 Dec 14 11:45 my_constants.py -rwxr-xr-x 1 pi pi 25K Dec 14 11:45 paperpi.py drwxr-xr-x 18 pi pi 4.0K Dec 14 12:01 plugins drwxr-xr-x 2 root root 4.0K Dec 14 12:01 pycache drwxr-xr-x 5 root root 4.0K Dec 14 11:51 venv_paperpi drwxr-xr-x 2 pi pi 4.0K Dec 14 11:45 waveshare_epd

pi@raspberrypi:~ $ ls -alh /usr/local/paperpi/fonts total 68K drwxr-xr-x 15 pi pi 4.0K Dec 14 11:45 . drwxr-xr-x 9 pi pi 4.0K Dec 14 12:01 .. drwxr-xr-x 2 pi pi 4.0K Dec 14 11:45 ABeeZee drwxr-xr-x 2 pi pi 4.0K Dec 14 11:45 Anton drwxr-xr-x 2 pi pi 4.0K Dec 14 11:45 BenchNine drwxr-xr-x 3 pi pi 4.0K Dec 14 11:45 Dosis drwxr-xr-x 2 pi pi 4.0K Dec 14 11:45 Economica drwxr-xr-x 2 pi pi 4.0K Dec 14 11:45 Josefin_Sans drwxr-xr-x 2 pi pi 4.0K Dec 14 11:45 Kanit drwxr-xr-x 2 pi pi 4.0K Dec 14 11:45 Lato drwxr-xr-x 2 pi pi 4.0K Dec 14 11:45 LibreCaslonText drwxr-xr-x 2 pi pi 4.0K Dec 14 11:45 Montserrat -rw-r--r-- 1 pi pi 4.5K Dec 14 11:45 OFL.txt drwxr-xr-x 2 pi pi 4.0K Dec 14 11:45 Open_Sans drwxr-xr-x 3 pi pi 4.0K Dec 14 11:45 Oswald drwxr-xr-x 2 pi pi 4.0K Dec 14 11:45 Sarabun

txoof commented 10 months ago

@selsarkin There's something larger going on under bookworm with the non IT8951 boards (yours). I've figured out that the problem has something to do with how paperpi wants to talk to the GPIO bus.

Hopefully I'll have a solution soon.

Thanks for the info. I'll keep you posted.

selsarkin commented 10 months ago

This came up. pi@raspberrypi:/usr/local/paperpi $ python3 paperpi.py Traceback (most recent call last): File "/usr/local/paperpi/paperpi.py", line 27, in import ArgConfigParse ModuleNotFoundError: No module named 'ArgConfigParse'

txoof commented 10 months ago

@selsarkin It looks like you're running it as root; it's not meant to be run as root and that's causing some of these problems. I see the GPIO errors too that tell you to try it as root too. That's definitely not supposed to happen.

I'm not entirely sure what's causing that, but I've further narrowed it down something in the sub routines that write to the screen.

txoof commented 9 months ago

@selsarkin TL;DR: I think I've finally resolved the issues that were causing your crash. Would you mind trying again?

There were many busted things that needed tending from problems with the waveshare libraries to issues around the installer for bookworm. I think I've ironed them all out and it should be ready to install.

txoof commented 8 months ago

@selsarkin This ticket's been open a while with no movement. I'm going to close it.

If there are more developments, @ me here and I'll reopen it.