Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions python_files/python_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import sys
import traceback
import uuid
from pathlib import Path
from typing import Dict, List, Optional, Union

STDIN = sys.stdin
Expand Down Expand Up @@ -172,6 +173,16 @@ def get_headers():


if __name__ == "__main__":
# https://docs.python.org/3/tutorial/modules.html#the-module-search-path
# The directory containing the input script (or the current directory when no file is specified).
# Here we emulate the same behavior like no file is specified.
input_script_dir = Path(__file__).parent
script_dir_str = str(input_script_dir)
if script_dir_str in sys.path:
sys.path.remove(script_dir_str)
while "" in sys.path:
sys.path.remove("")
sys.path.insert(0, "")
while not STDIN.closed:
try:
headers = get_headers()
Expand Down
Loading