Skip to content

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

@alicedb2

Description

@alicedb2

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions