microsoft / cascadia-code

This is a fun, new monospaced font that includes programming ligatures and is designed to enhance the modern look and feel of the Windows Terminal.
Other
25.39k stars 803 forks source link

Permission denied when building on Windows #520

Closed ysc3839 closed 3 years ago

ysc3839 commented 3 years ago

Cascadia family version

main

Cascadia family variant(s)

Cascadia Code (the version with ligatures), Cascadia Mono (the version without ligatures)

Font file format(s)

I don't know

Platform

Windows

Other Software

No response

What happened?

Permission denied when building on Windows.

Log:

Traceback (most recent call last):
  File "C:\Users\Richard\AppData\Local\Programs\Python\Python39\lib\multiprocessing\pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "C:\Users\Richard\Desktop\Dev\cascadia-code\build.py", line 198, in build_font_variable
    compile_variable_and_save(designspace, vtt_compile)
  File "C:\Users\Richard\Desktop\Dev\cascadia-code\build.py", line 264, in compile_variable_and_save
    varFont.saveXML(TSICfile.name, tables=["TSIC"])
  File "C:\Users\Richard\Desktop\Dev\cascadia-code\fonttools-venv\lib\site-packages\fontTools\ttLib\ttFont.py", line 227, in saveXML
    writer = xmlWriter.XMLWriter(fileOrPath, newlinestr=newlinestr)
  File "C:\Users\Richard\Desktop\Dev\cascadia-code\fonttools-venv\lib\site-packages\fontTools\misc\xmlWriter.py", line 21, in __init__
    self.file = open(fileOrPath, "wb")
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\Richard\\AppData\\Local\\Temp\\tmpzavm5np6'

Code: https://github.com/microsoft/cascadia-code/blob/b8604c2bd9440aefc21634972992ba9a8e953f57/build.py#L262-L265 I think it's because tempfile.NamedTemporaryFile() opens the file, and then varFont.saveXML opens that file again. Also these code looks useless, are they for debugging?

aaronbell commented 3 years ago

Sorry to hear that you're having troubles. That code was from a previous version of the build script which required an extra step to get the TSIC table to build properly. You can remove them.

That said, @Dhowett has been able to build using this script on Windows without problems, so you might want to check the permissions on your device too.

DHowett commented 3 years ago

Nah, this has been one of the terrifically annoying things I've run into. I thought that it was an issue with "packaged" python -- the one that ships in the store -- but it looks like it's somewhat more complicated than that. I always run it under WSL because it's just plain easier.

If we aren't using that code, let's just pull it out and then folks will be able to run the build locally. :D

ysc3839 commented 3 years ago

I can confirm it's not permission issue. The temp directory on my system inherited permissions from user's home directory. It's because the file was open with no sharing, so it can't be opened again.