My app is connected to a Pico W, and I’m trying to use the following code to send the “ftx_dspsave1” command. I have several other similar server calls in my code that work as intended, but this one seems to cause the “Error: local variable referenced before assignment”
from anvil import *
import anvil.facebook.auth
import anvil.server
import anvil.google.auth, anvil.google.drive
from anvil.google.drive import app_files
import anvil.users
import anvil.tables as tables
import anvil.tables.query as q
from anvil.tables import app_tables
class Dose(DoseTemplate):
def __init__(self, **properties):
# Set Form properties and Data Bindings.
self.init_components(**properties)
#TODO: put items in designer
def button_1_click(self, **event_args):
"""This method is called when the button is clicked"""
anvil.server.call_s("ftx_dspsave1")
pass
Thanks for the reply. You can tell why I’m confused- there are no variables I’m trying to reference. I can replace anvil.server.call_s(“ftx_dspsave1”) with several other calls that work just fine, but for some reason this call (and anvil.server.call_s(“ftx_dspsave2”) cause the variable reference error.
I have no data bindings anywhere in my app. I’m still learning Anvil and haven’t found a use for data bindings yet… mainly because I don’t know how they work.
Thanks for the ideas - I haven’t solved the problem but I am now confident it’s not in the code on Anvil.
I commented out everything run by the command on the Pico and the command worked without error. I’ll have to dig into that code to find the culprit. I was thrown off by the error traceback only appearing on the Anvil side.