File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 55import sys
66import traceback
77import uuid
8+ from pathlib import Path
89from typing import Dict , List , Optional , Union
910
1011STDIN = sys .stdin
@@ -172,6 +173,16 @@ def get_headers():
172173
173174
174175if __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+ script_dir_str = str (input_script_dir )
181+ if script_dir_str in sys .path :
182+ sys .path .remove (script_dir_str )
183+ while "" in sys .path :
184+ sys .path .remove ("" )
185+ sys .path .insert (0 , "" )
175186 while not STDIN .closed :
176187 try :
177188 headers = get_headers ()
You can’t perform that action at this time.
0 commit comments