Open anastazie opened 1 year ago
Hey, I also had this issue, chatGPT gave me the below which works for me.
`import socket from contextlib import closing
def find_free_port(): with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as s: s.bind(('',0)) # '' means localhost and 0 means to find a free port s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) return s.getsockname()[1]
if name == 'main': port = find_free_port() app.run_server(debug=True, port=port) `
Hello, When I run code cell second time in the notebook, I am getting
OSError: Address 'http://127.0.0.1:8050' already in use.
The only thing that helps is restarting kernel. Is this an expected behaviour? If so, it makes it hard to use jupyter-dash to develop app.jupyter-dash 0.4.2
Ubuntu 22.04
Example script