1

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?

donut
  • 628
  • 2
  • 9
  • 23
  • A file exists in that path? – Daniel Butler Jul 09 '20 at 03:56
  • Yes, the file ```tmpwjie6exl``` exists in the path. Every time I run it, it generated a different file. – donut Jul 09 '20 at 05:50
  • And it’s actually a file not a folder, permission denied error does seem to point to something other than file not found error? Sometimes that means the file is opened by another process. – Daniel Butler Jul 09 '20 at 10:37

0 Answers0