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 5
5
import sys
6
6
import traceback
7
7
import uuid
8
+ from pathlib import Path
8
9
from typing import Dict , List , Optional , Union
9
10
10
11
STDIN = sys .stdin
@@ -172,6 +173,16 @@ def get_headers():
172
173
173
174
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
+ 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 , "" )
175
186
while not STDIN .closed :
176
187
try :
177
188
headers = get_headers ()
You can’t perform that action at this time.
0 commit comments