We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 11fa35d commit 35fbd73Copy full SHA for 35fbd73
python_files/python_server.py
@@ -5,6 +5,7 @@
5
import sys
6
import traceback
7
import uuid
8
+from pathlib import Path
9
from typing import Dict, List, Optional, Union
10
11
STDIN = sys.stdin
@@ -172,6 +173,12 @@ def get_headers():
172
173
174
175
if __name__ == "__main__":
176
+ # https://docs.python.org/3/tutorial/modules.html#the-module-search-path
177
+ # The directory containing the input script (or the current directory when no file is specified).
178
+ # Here we emulate the same behavior like no file is specified.
179
+ input_script_dir = Path(__file__).parent
180
+ sys.path.remove(str(input_script_dir))
181
+ sys.path.insert(0, str(Path.cwd()))
182
while not STDIN.closed:
183
try:
184
headers = get_headers()
0 commit comments