Skip to content

PermissionError: [Errno 13] on Windows 10 #37

Open
@maxfire2008

Description

@maxfire2008

On Windows I get an error. This is because tmp = tempfile.NamedTemporaryFile(suffix=suffix) (line 84) opens and locks the file.
This can be fixed by calling tmp.close() directly afterwards but I don't know if this breaks anything on other OSes.

>>> editor.edit(contents="hello")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Max\AppData\Local\pypoetry\Cache\virtualenvs\bulletin-3-N3PFQvT7-py3.10\lib\site-packages\editor.py", line 92, in edit
    with open(filename, mode='wb') as f:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\Max\\AppData\\Local\\Temp\\tmp55cimtei'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions