'Python runs differently in colab than on a server

I am trying to deploy a python program which listens to a user websocket via the python-binance package. It shouldn't stop by itself and just continue to listen on the websocket and print anything that happens.

I was using google colab to run the code during testing, everything was working perfectly fine, so I put the code into a python file and tried to run it on an AWS ec2 instance. I tried it both in a virtual env and in a docker container.

In both cases I had the same issue, after a short amount of times it stopped printing events of the websocket. On colab this never happened.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source