0

I was using google sheet api and service account to write to a google sheet in my script. I have converted my python script to exe file. though my original script was working fine but now I am getting following error when running the exe file

googleapiclient.errors.UnknownApiNameOrVersion: name: sheets version: v4

Full traceback:

Traceback (most recent call last):
  File "pygsheets\sheet.py", line 39, in __init__
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\DC\\AppData\\Local\\Temp\\_MEI165082\\pygsheets\\data\\sheets_discovery.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "script.py", line 50, in <module>
  File "Scrapers\showclix.py", line 15, in __init__
  File "pygsheets\authorization.py", line 131, in authorize
  File "pygsheets\client.py", line 61, in __init__
  File "pygsheets\sheet.py", line 43, in __init__
  File "googleapiclient\_helpers.py", line 130, in positional_wrapper
  File "googleapiclient\discovery.py", line 287, in build
  File "googleapiclient\discovery.py", line 404, in _retrieve_discovery_doc
googleapiclient.errors.UnknownApiNameOrVersion: name: sheets  version: v4

I have tried both the solution listed in this thread: https://github.com/nithinmurali/pygsheets/issues/490

Also, I have converted the script to exe using pyinstaller which created a build and dist folder.

glitch_123
  • 139
  • 12

1 Answers1

0

I was having the same problem and found that adding "static_discovery=False" to the build parameters worked