Psycojoker / prosopopee

a static website generator to make beautiful customizable pictures galleries that tell a story
http://prosopopee.readthedocs.org
GNU General Public License v3.0
318 stars 55 forks source link

ValueError: too many values to unpack (expected 2) #144

Open alicedb2 opened 2 years ago

alicedb2 commented 2 years ago

Ran prosopopee directly in the example/ directory and it throws the following error

Traceback (most recent call last):
  File "/Users/alice/miniconda3/bin/prosopopee", line 33, in <module>
    sys.exit(load_entry_point('prosopopee==1.1.4', 'console_scripts', 'prosopopee')())
  File "/Users/alice/miniconda3/lib/python3.8/site-packages/prosopopee-1.1.4-py3.8.egg/prosopopee/prosopopee.py", line 856, in main
    process_directory(gallery.normpath(), settings, templates)
  File "/Users/alice/miniconda3/lib/python3.8/site-packages/prosopopee-1.1.4-py3.8.egg/prosopopee/prosopopee.py", line 570, in process_directory
    process_directory(
  File "/Users/alice/miniconda3/lib/python3.8/site-packages/prosopopee-1.1.4-py3.8.egg/prosopopee/prosopopee.py", line 547, in process_directory
    build_gallery(settings, gallery_settings, gallery_path, parent_templates)
  File "/Users/alice/miniconda3/lib/python3.8/site-packages/prosopopee-1.1.4-py3.8.egg/prosopopee/prosopopee.py", line 647, in build_gallery
    html = template_to_render.render(
  File "/Users/alice/miniconda3/lib/python3.8/site-packages/jinja2/environment.py", line 1291, in render
    self.environment.handle_exception()
  File "/Users/alice/miniconda3/lib/python3.8/site-packages/jinja2/environment.py", line 925, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "/Users/alice/miniconda3/lib/python3.8/site-packages/prosopopee-1.1.4-py3.8.egg/prosopopee/themes/exposure/templates/gallery-index.html", line 30, in top-level template code
    {% include "sections/" + section.type + ".html" %}
  File "/Users/alice/miniconda3/lib/python3.8/site-packages/prosopopee-1.1.4-py3.8.egg/prosopopee/themes/exposure/templates/sections/pictures-group.html", line 13, in top-level template code
    {% set ratio = video.ratio %}
  File "/Users/alice/miniconda3/lib/python3.8/site-packages/jinja2/environment.py", line 474, in getattr
    return getattr(obj, attribute)
  File "/Users/alice/miniconda3/lib/python3.8/site-packages/prosopopee-1.1.4-py3.8.egg/prosopopee/prosopopee.py", line 215, in ratio
    width, height = out.decode("utf-8").split(",")
ValueError: too many values to unpack (expected 2)

out.decode("utf-8") returns 1920,1080, so naturally the second comma makes it so that that out.decode("utf-8").split(",") returns ['1920', '1080', ''].

As a stopgap I change the line to

width, height = out.decode("utf-8").split(",")[:2]

and prosopopee terminated normally.