small fixes

This commit is contained in:
2026-08-08 16:47:09 +02:00
parent f345f8bb4f
commit c535febbc4
6 changed files with 54 additions and 47 deletions
+18
View File
@@ -23,6 +23,24 @@ def enonce_total(base_dir):
return "".join(output)
import os
import shlex
def edit_file_and_enter(file):
editor = os.environ.get("EDITOR")
try:
if editor:
subprocess.run(shlex.split(editor) + [str(file)])
else:
if sys.platform.startswith("linux"):
subprocess.run(["xdg-open", str(file)])
elif sys.platform == "darwin":
subprocess.run(["open", str(file)])
else:
os.startfile(str(file))
input("Press ENTER here once you have saved and closed the text file...")
except Exception as e:
print(f"Error running editor: {e}")
def pdf_image_of_enonce(root_dir, label):
pdf_path = os.path.join(root_dir, "Text2", f"{label}.pdf")