Python 3.7: Pygsheets get all record stopped working

565 views Asked by At

I have several scripts using pygsheets to get information from google sheets. Today they have stopped working without any errors or exceptions being noted.

Debuging Attempts:

Tried running in different ways 1. Visual Studio Code - just stops working no errors or exceptions. Debugged to line (wks = sh.worksheet('title', tabs)) 2. command prompt - pops a window up that states "Python has stopped working: A problem caused the program to stop working correctly. Please close the program" 3. manually in IDLE - locks up at (wks = sh.worksheet('title', tabs)) 4. Ran code on a different machine: worked fine.

So, I know it has to do with something on my machine, but not sure where to start looking. Any suggestions are welcome.

import pygsheets 
from pygsheets import Worksheet
gsheet = pygsheets.authorize(service_file = 'client_secret2.json')
sh = gsheet.open('Google_file_name')
wks = sh.worksheet('title', 'tab_name')
results = wks.get_all_records()

The last line is where everything stops. Again, no errors or exceptions.

1

There are 1 answers

0
Ctrl S On

I know this doesn't really solve the issue, nor do I have experience with pygsheets, but from my experience with gspread the issue appears to be connection-related. I have had this exact issue with gspread's get_all_values module and, as you experienced, it suddenly stops working without any changes to the code and without terminating or returning any errors. The issue often disappears when the program is run again minutes or days later.

The only other time I have experienced freezing/hanging (recently in Python) is with TCP connections...