Unexpected: The uplink server for '[function in script on personal computer]' has been disconnected at Form1, line XX

I wrote a script on my machine using the Server Uplink to print a message to the Output in my app (similar to the Server Uplink tutorial with the Raspberry Pi). I got it to run a couple times, but now I get the error message:

unexpected: The uplink server for 'say_hello' has been disconnected
at Form1, line 11

I tried regenerating my uplink key, which worked once. Now, no matter what I do it won’t connect. My personal machine doesn’t give any errors, it shows a successful connection. How can I fix it?
Have I accessed the Server Uplink in too rapid a succession as I was testing my app or something?

Edit: I used Cntl + C on my Mac in terminal to exit out of the anvil.server.wait_forever() loop as I was trying to correct my code. Is this the problem?

Hi Chris,

That’s odd, please can you email us on support@anvil.works with a link to your app when you’re next looking at this and we’ll do our best to get that fixed for you.

[Moved to Bug reports category.]

- Thanks, Ian.

This has now been fixed at our end - thanks for the report!

Please can you clarify if the fix was at your host or do we need to reinstall/update anvil on the target machine using pip?

Thanks for the help! I think it did the trick, however, I did a “pip install --upgrade anvil-uplink” and now I’m getting this traceback:

$ python uplink_test.py
Traceback (most recent call last):
File “uplink_test.py”, line 1, in
import anvil.server
File “/usr/local/lib/python2.7/site-packages/anvil/server.py”, line 6, in
from . import _server, _serialise, _threaded_server
File “/usr/local/lib/python2.7/site-packages/anvil/_threaded_server.py”, line 7, in
from ._server import LazyMedia, registrations
ImportError: cannot import name registrations

It seems like something broke in the upgrade?

Edit: I did “sudo pip install --upgrade anvil”, now I get this traceback:
Traceback (most recent call last):
File “uplink_test.py”, line 1, in
import anvil.server
File “/usr/local/lib/python2.7/site-packages/anvil/server.py”, line 6, in
from . import _server, _serialise, _threaded_server
File “/usr/local/lib/python2.7/site-packages/anvil/_server.py”, line 12, in
class LiveObjectProxy(anvil.LiveObject):
AttributeError: ‘module’ object has no attribute ‘LiveObject’

What have I broken?

Hmm, it seems that our anvil-uplink package might conflict with the anvil package (which is nothing to do with us). Can you try running:

pip uninstall anvil
pip uninstall anvil-uplink
pip install anvil-uplink

And see if that fixes things?

I did that, now my traceback reads:

Traceback (most recent call last):
File “uplink_test.py”, line 1, in
import anvil.server
File “/usr/local/lib/python2.7/site-packages/anvil/server.py”, line 6, in
from . import _server, _serialise, _threaded_server
File “/usr/local/lib/python2.7/site-packages/anvil/_threaded_server.py”, line 7, in
from ._server import LazyMedia, registrations
ImportError: cannot import name registrations

Here is my code on my Mac, it looks like I’m calling “import anvil.server” correctly. Not sure what else could be wrong:

import anvil.server

@anvil.server.callable
def say_hello():
  print("Hello from the uplink!")

anvil.server.connect("[my_key]")
anvil.server.wait_forever()

Hi Chris,

Sorry about that, it seems our release of the PyPi package had not included some of our latest updates. I believe the release process is now fixed - please could you try again? You should get anvil-uplink 0.3.9.

Please let me know if that’s working now!

1 Like

That did the trick, it’s working again!

Great! Sorry about that, thanks for your patience!

@david.wylie You only need to upgrade your local anvil-uplink package if you’re experiencing problems. The changes we made in the last 24 hours are not breaking, and most of the fix was at our end.

Closing this topic now that it’s resolved.