Anvil Community Forum

[FIXED] Error accessing google sheets - client vs server?

What I’m trying to do:
I am trying to access a google sheet from a server module but am getting this error:

RecursionError: Maximum call stack size exceeded
at anvil-services/anvil/google/sheets.py, line 26 column 8
  called from anvil-services/anvil/google/sheets.py, line 26 column 8

..1000x times...


  called from anvil-services/anvil/google/sheets.py, line 26 column 8
  called from Form1, line 39

What I’ve tried and what’s not working:
When I try is from the client it works fine, but when the “same” code runs on the server I get this recursion error.

Code Sample:

# in a form...
  def button_3_click(self, **event_args):
    """This method is called when the button is clicked"""
    
    db = app_files.transactions
    results = db['Sheet1'].rows
    print("Client: ",len(results))
   

  def button_4_click(self, **event_args):
    """This method is called when the button is clicked"""
    results = anvil.server.call('get_it')
    
    print("Server:", len(results))


....
#server code:

from anvil.google.drive import app_files
import anvil.server

@anvil.server.callable
def get_it():
  
  db = app_files.transactions
  results = db['Sheet1'].rows
  return results

and the output is

Client: 17
RecursionError: Maximum call stack size exceeded
at anvil-services/anvil/google/sheets.py, line 26 column 8
  called from anvil-services/anvil/google/sheets.py, line 26 column 8
  called from anvil-services/anvil/google/sheets.py, line 26 column 8
  called from anvil-services/anvil/google/sheets.py, line 26 column 8
  called from anvil-services/anvil/google/sheets.py, line 26 column 8

..1000x..

 called from anvil-services/anvil/google/sheets.py, line 26 column 8
  called from Form1, line 39

Thanks for the report we’ll look into that and get back to you.

1 Like

This should now be fixed - thanks for the report!

1 Like

@meredydd thanks for the update. How do I get access to the fix? (it doesn’t appear to be fixed in my app, but is there an upgrade process that I need to perform to get the fix?).

Sorry @niall, it turns out we hadn’t released the fix. It should now be fixed and you shouldn’t have to do anything else. Let us know if you still experience problems.

1 Like