Skip to content

Conversation

@r7nd7
Copy link

@r7nd7 r7nd7 commented Mar 30, 2025

Problem

When using the _embed_annotations , users may run into unpacking errors in the get_bookmarks() and get_highlights() functions inside sioyek.py.

These functions expect a fixed number of columns returned by SQLite queries. However, on some systems (e.g., Arch Linux with Python 3.12+), the database may return extra columns due to schema changes or environment-specific differences.

This can trigger errors like:

  • ValueError: too many values to unpack (expected 4)
  • ValueError: too many values to unpack (expected 8)

These issues break the _embed_annotations feature, which depends on both functions to extract highlights and bookmarks.


What this PR does

  • Replaces fixed unpacking with a more robust pattern that handles extra columns gracefully
  • Uses length checks and wildcard unpacking (*_) to capture only the needed fields
  • Preserves the original behavior using list comprehensions
  • Makes _embed_annotations more reliable across environments

Testing

  • Verified _embed_annotations works correctly after adding highlights and bookmarks
  • Tested with Sioyek installed via pip on Python 3.12
  • Used a PDF with real annotations to confirm that embed_annotations.py runs successfully

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