Hi - rereading my post I was a little vague. Typical of my typing whilst thinking instead of thinking what I’m typing …
So, when the uplink script tried to call a server function in the Anvil hosted app, I got this :
$ python numberdealer_v3_uplink.py
Connecting to wss://anvil.works/uplink
Anvil websocket open
Connected to "Private link to branch master" as SERVER
<redacted - I printed my uplink key>
Traceback (most recent call last):
File "/home/user/Documents/dev/NumberDealer V3/.venv/lib/python3.12/site-packages/anvil/server.py", line 411, in call
return _do_call(args, kwargs, fn_name=fn_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/Documents/dev/NumberDealer V3/.venv/lib/python3.12/site-packages/anvil/server.py", line 401, in _do_call
return _threaded_server.do_call(args, kwargs, fn_name=fn_name, live_object=live_object)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/Documents/dev/NumberDealer V3/.venv/lib/python3.12/site-packages/anvil/_threaded_server.py", line 436, in do_call
raise error_from_server
anvil._server.NoServerFunctionError: No server function matching "aaaaa" has been registered
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/user/Documents/dev/NumberDealer V3/python_code/numberdealer_v3_uplink.py", line 50, in <module>
print(anvil.server.call("aaaaa"))
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/Documents/dev/NumberDealer V3/.venv/lib/python3.12/site-packages/anvil/server.py", line 414, in call
raise _server._deserialise_exception(e.error_obj)
anvil._server.NoServerFunctionError: No server function matching "aaaaa" has been registered
The main app had this definition :
@anvil.server.callable
def aaaaa():
return "hello"
The uplink code had this (snippet) :
import anvil.server
import os
import id_factory
import login
anvil.server.connect(os.environ.get('ND3_UPLINK_SERVER_KEY', ''))
print (os.environ.get('ND3_UPLINK_SERVER_KEY', ''))
from portable_classes import Response
@anvil.server.callable
def authenticate_user(**kwargs):
auth = login.LoginDatabase("../databases/logins.db")
return auth.authenticate(kwargs.get("username", None), kwargs.get("password", None))
@anvil.server.callable
def uplink_ping(**kwargs):
print("in ping")
return "pong"
and the main app was doing :
try:
print("hello 1")
ret = anvil.server.call("uplink_ping")
print("hello 2")
except Exception as e:
print("failed")
“hello 1” got printed, “hello 2” did not, and all I saw was the spinney thing.
The anvil main app was running in the IDE. The app is not published yet.
Hope that helps?