Skip to content

Commit 03d8c4e

Browse files
committed
Fix issue in python sdk on fast close
1 parent 1d06e1b commit 03d8c4e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

python/e2b_code_interpreter/main.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,10 @@ def _start_connecting_to_default_kernel(
278278
def setup_default_kernel():
279279
kernel_id = self._sandbox.filesystem.read(
280280
"/root/.jupyter/kernel_id", timeout=timeout
281-
).strip()
281+
)
282+
if kernel_id is None and not self._sandbox.is_open:
283+
return
284+
282285
logger.debug(f"Default kernel id: {kernel_id}")
283286
self._connect_to_kernel_ws(kernel_id, timeout=timeout)
284287
self._kernel_id_set.set_result(kernel_id)

python/tests/test_reconnect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from e2b_code_interpreter.main import CodeInterpreter
22

33

4-
def test_basic():
4+
def test_reconnect():
55
with CodeInterpreter() as sandbox:
66
sandbox_id = sandbox.id
77

0 commit comments

Comments
 (0)