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?
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.
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’
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()
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.
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.