I am trying to run a simple code using pygsheets. This code has already been tested in other computers, so it is probably some configuration in my machine or OS. In the two lines:
creds_file = _google_creds_as_file()
gc = pygsheets.authorize(service_account_file=creds_file.name)
The function _google_creds_as_file()
returns a temporary file with certain name, and when I call gc
, it always returns the same error:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\User\\AppData\\Local\\Temp\\tmpwjie6exl'
This happens even when I run the Python script as an administrator. If I delete this file, another one, with a different name is generated, and the problem persists.
What can I do to solve this error?