afdko icon indicating copy to clipboard operation
afdko copied to clipboard

[checkoutlinesufo] FileNotFoundError when glyphs.com.adobe.type.processedglyphs is empty

Open arialcrime opened this issue 2 years ago • 2 comments

Within git I use the option to discard uncommitted changes quite a lot during font production work. While that’s super handy to get back to previous states of the files, it can also result in empty folders being left within UFOs.

One of these cases is when I run checkoutlinesufo -e path/to/ufo/file.ufo and discard those changes after. I don’t think an empty folder in a UFO is an issue in itself, but sadly it causes the following FileNotFoundError:

Traceback (most recent call last):
  File "/Users/benedikt/fdev/bin/checkoutlinesufo", line 8, in <module>
    sys.exit(main())
  File "/Users/benedikt/fdev/lib/python3.10/site-packages/afdko/checkoutlinesufo.py", line 1151, in main
    run(sys.argv[1:])
  File "/Users/benedikt/fdev/lib/python3.10/site-packages/afdko/checkoutlinesufo.py", line 1001, in run
    defcon_font = font_file.open(use_hash_map)
  File "/Users/benedikt/fdev/lib/python3.10/site-packages/afdko/checkoutlinesufo.py", line 68, in open
    ufotools.validateLayers(font_path)
  File "/Users/benedikt/fdev/lib/python3.10/site-packages/afdko/ufotools.py", line 1041, in validateLayers
    cleanUpGLIFFiles(defaultContentsFilePath, glyphDirPath, doWarning)
  File "/Users/benedikt/fdev/lib/python3.10/site-packages/afdko/ufotools.py", line 905, in cleanUpGLIFFiles
    with open(contentsFilePath, 'r', encoding='utf-8') as fp:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/benedikt/Desktop/TEMP/230130/checkoutlinesufo_test/font.ufo/glyphs.com.adobe.type.processedglyphs/contents.plist'

I’m not very familiar with how ufotools works, but I can imagine that a check if there is something in the folder could resolve this? Below you can find a zip with 2 files, one after running the checkoutlinesufo command from above, and the other after discarding the changes.

Let me know if you need anything else! checkoutlinesufo_test.zip

arialcrime avatar Jan 30 '23 15:01 arialcrime

Did you try to use the --all option? It might be better to start fresh?

frankrolf avatar Jan 30 '23 16:01 frankrolf

(doesn’t work). I agree an empty folder should not make the tool stumble, I’ll have a look.

frankrolf avatar Jan 30 '23 16:01 frankrolf