[Answer]-Permission denied on trying to write file

1👍

One possibility is that the directory already exists, which, according to this should raise an error.

It is also possible that the directory is used in some other program, like explorer, and that needs to be closed first.

A third option I can think of is that the default permissions for a directory on your system don’t allow reading by a user, in which case your program would need to be run as an administrator or use the win32security module from pywin32 to manually set permissions for the directory(although that may also not work if you don’t have permission to change permissions).

👤hajtos

Leave a comment