diffenator2 icon indicating copy to clipboard operation
diffenator2 copied to clipboard

Bug with UCD data "BadZipFile" on first run

Open belluzj opened this issue 2 years ago • 4 comments

It only happens when running the first time, then when running again it's fine, so maybe some timing issue, not waiting until the end of some download? And not blocking, since it's enough to restart the run. Here is the stacktrace:

[4/5] _diffenator "build/Font/variable/old-Font-Italic.ttf" "bui...um Italic-Text Bold Italic/Text-Bold-Italic' -ch ".*" --coords axes=...
FAILED: out/Bold Italic-Italic-Medium Italic-Text Bold Italic/Text-Bold-Italic
_diffenator "build/Font/variable/old-Font-Italic.ttf" "build/Font/variable/Font-Italic.ttf" -t 0.9 -o 'out/Bold Italic-Italic-Medium Italic-Text Bold Italic/Text-Bold-Italic' -ch ".*" --coords axes=...
Traceback (most recent call last):
  File "/home/jany_belluz/.local/bin/_diffenator", line 8, in <module>
    sys.exit(main())
  File "/home/jany_belluz/.local/pipx/venvs/diffenator2/lib/python3.10/site-packages/diffenator2/_diffenator.py", line 83, in main
    diff.diff_all()
  File "/home/jany_belluz/.local/pipx/venvs/diffenator2/lib/python3.10/site-packages/diffenator2/_diffenator.py", line 30, in diff_all
    getattr(self,f)()
  File "/home/jany_belluz/.local/pipx/venvs/diffenator2/lib/python3.10/site-packages/diffenator2/_diffenator.py", line 39, in diff_words
    self.glyph_diff = test_fonts(self.old_font, self.new_font, threshold=self.threshold)
  File "/home/jany_belluz/.local/pipx/venvs/diffenator2/lib/python3.10/site-packages/diffenator2/shape.py", line 53, in test_fonts
    words = test_font_words(font_a, font_b, skip_glyphs, threshold=threshold)
  File "/home/jany_belluz/.local/pipx/venvs/diffenator2/lib/python3.10/site-packages/diffenator2/shape.py", line 87, in test_font_words
    data = ucd_data(k)
  File "/home/jany_belluz/.local/pipx/venvs/diffenator2/lib/python3.10/site-packages/youseedee/__init__.py", line 176, in ucd_data
    out.update(props["datareader"](file, codepoint))
  File "/home/jany_belluz/.local/pipx/venvs/diffenator2/lib/python3.10/site-packages/youseedee/__init__.py", line 73, in dictget
    fileentry["data"] = fileentry["reader"](filename)
  File "/home/jany_belluz/.local/pipx/venvs/diffenator2/lib/python3.10/site-packages/youseedee/__init__.py", line 58, in parse_file_semicolonsep
    ensure_files()
  File "/home/jany_belluz/.local/pipx/venvs/diffenator2/lib/python3.10/site-packages/youseedee/__init__.py", line 40, in ensure_files
    with zipfile.ZipFile(zip_path, 'r') as zip_ref:
  File "/usr/lib/python3.10/zipfile.py", line 1269, in __init__
    self._RealGetContents()
  File "/usr/lib/python3.10/zipfile.py", line 1336, in _RealGetContents
    raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file

belluzj avatar Oct 12 '23 14:10 belluzj

@simoncozens seems to be occurring due to youseedee

m4rc1e avatar Nov 15 '23 15:11 m4rc1e

Yeah, looks like it but I can't repro. :-/ @belluzj Could you

a) Clean out your ~/.youseedee folder and try again? b) If it fails again, inspect ~/.youseedee/UCD.zip.

simoncozens avatar Nov 17 '23 17:11 simoncozens

To fix this in diffenator2, the youdeesee dependency needs to be updated to at least v0.5.0 (from ^0.3.0)

Unfortunately, trying this locally meant all the functional tests failed. Not sure if that's my environment or not, but it wasn't exactly encouraging :(

RickyDaMa avatar Jan 17 '24 16:01 RickyDaMa

@RickyDaMa I just updated youseedee to 0.5.0 and deleted ~/.youseedee and all checks pass (I'm on OS X).

Lemme open a PR and see what our win ci makes of it.

m4rc1e avatar Jan 17 '24 16:01 m4rc1e