File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,8 @@ def format_metadata_as_citations(metadata_list):
44
44
return "\n " .join (citations )
45
45
46
46
def write_contexts_to_file_and_open (contexts ):
47
+ contexts_output_file_path = Path ('contexts.txt' )
48
+
47
49
with contexts_output_file_path .open ('w' , encoding = 'utf-8' ) as file :
48
50
for index , context in enumerate (contexts , start = 1 ):
49
51
file .write (f"------------ Context { index } ---------------\n \n " )
@@ -52,9 +54,9 @@ def write_contexts_to_file_and_open(contexts):
52
54
if os .name == 'nt' :
53
55
os .startfile (contexts_output_file_path )
54
56
elif sys .platform == 'darwin' :
55
- subprocess . Popen ([ 'open' , str ( contexts_output_file_path )] )
57
+ os . system ( f 'open { contexts_output_file_path } ' )
56
58
elif sys .platform .startswith ('linux' ):
57
- subprocess . Popen ([ 'xdg-open' , str ( contexts_output_file_path )] )
59
+ os . system ( f 'xdg-open { contexts_output_file_path } ' )
58
60
else :
59
61
raise NotImplementedError ("Unsupported operating system" )
60
62
You can’t perform that action at this time.
0 commit comments