Open mmcky opened 1 year ago
for 3:
from subprocess import Popen
def find_free_port():
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.bind(('', 0))
return s.getsockname()[1]
free_port = find_free_port()
print(f"Starting Jupyter Lab on port {free_port}")
Popen(["jupyter", "lab", f"--port={free_port}"])
python3 start_jupyter.py
todo:
@chappiewuzefan any thoughts on this would be great
If another user is logged into the server and uses
--port=8080
for port redirection then this causes port collisions if another user tries to request the same port.We could either:
jupyter-lab
.