Skip to content

Commit 3231002

Browse files
committed
Allow running from frozen executable
1 parent 722a58f commit 3231002

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

interpreter/core/computer/terminal/languages/jupyter_language.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import ast
77
import logging
8+
import sys
89
import os
910
import queue
1011
import re
@@ -19,6 +20,18 @@
1920
DEBUG_MODE = False
2021

2122

23+
# Handling the case where the script is called as a kernel
24+
if 'ipykernel_launcher' in sys.argv:
25+
if sys.path[0] == '':
26+
del sys.path[0]
27+
28+
from ipykernel import kernelapp as app
29+
30+
app.launch_new_instance()
31+
sys.exit(0)
32+
33+
34+
# Rest of your Open Interpreter code
2235
class JupyterLanguage(BaseLanguage):
2336
file_extension = "py"
2437
name = "Python"

0 commit comments

Comments
 (0)