Skip to content

Commit 266b7e0

Browse files
committed
fix
1 parent 6df7e51 commit 266b7e0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

marimo/_server/print.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,11 @@ def _get_network_url(url: str) -> str:
6565
hostname = socket.gethostname()
6666
try:
6767
# Find a non-loopback IPv4 address
68-
with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as s:
69-
# Doesn't need to be reachable
70-
s.connect(("255.255.255.254", 1))
71-
local_ip = s.getsockname()[0]
68+
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
69+
# Doesn't need to be reachable
70+
s.connect(("255.255.255.254", 1))
71+
local_ip = s.getsockname()[0]
72+
s.close()
7273
except Exception:
7374
try:
7475
# Get all IPs for the hostname

0 commit comments

Comments
 (0)