abdnh / anki-zim-reader

Anki add-on to view and extract info from ZIM files

Home Page:https://ankiweb.net/shared/info/951350249

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Random struct.error exceptions thrown sometimes

abdnh opened this issue · comments

commented

Probably an issue in ZIMply/ZIMply-core. Reported in kimbauters/ZIMply#31

Currently, the pop-up dictionary is simply swallowing up the errors, as it doesn't seem to visibly affect resource loading as far as I can tell.

commented

A random issue with ValueError exceptions being thrown was also reported:

Traceback (most recent call last):
  File "flask.app", line 2073, in wsgi_app
  File "flask.app", line 1518, in full_dispatch_request
  File "flask.app", line 1516, in full_dispatch_request
  File "flask.app", line 1502, in dispatch_request
  File "C:\Users\Abdo\AppData\Roaming\Anki2\addons21\zim_reader\server.py", line 90, in handle_request
    article = zim_server.dictionary.zim_client.get_article(path)
  File "C:\Users\Abdo\AppData\Roaming\Anki2\addons21\zim_reader\vendor\zimply_core\zim_core.py", line 1244, in get_article
    article = self._zim_file.get_article_by_url(namespace, url, follow_redirect=follow_redirect)
  File "C:\Users\Abdo\AppData\Roaming\Anki2\addons21\zim_reader\vendor\zimply_core\zim_core.py", line 685, in get_article_by_url
    return self._get_article_by_index(idx, follow_redirect=follow_redirect)
  File "C:\Users\Abdo\AppData\Roaming\Anki2\addons21\zim_reader\vendor\zimply_core\zim_core.py", line 627, in _get_article_by_index
    result = self._read_blob(entry["clusterNumber"], entry["blobNumber"], return_offset)
  File "C:\Users\Abdo\AppData\Roaming\Anki2\addons21\zim_reader\vendor\zimply_core\zim_core.py", line 603, in _read_blob
    return cluster_data.read_blob(blob_index, return_offset=return_offset)
  File "C:\Users\Abdo\AppData\Roaming\Anki2\addons21\zim_reader\vendor\zimply_core\zim_core.py", line 374, in read_blob
    return data_buffer.read(blob_size) if not return_offset else data_buffer.tell()
ValueError: read length must be non-negative or -1

I've not been able to reproduce it yet and not sure if it's related.