diff --git a/latty.py b/latty.py index d63a4b5..f4b5322 100644 --- a/latty.py +++ b/latty.py @@ -16,6 +16,11 @@ def get_datetime(): now = datetime.now() return now.strftime("%Y-%m-%d %H:%M:%S") +root_dir = os.path.dirname(os.getcwd()) +proj_dir = root_dir + '/undercover/' +output_dir = proj_dir + 'outputs/' +base_tex_text = open(proj_dir + "/writing_templates/base.tex", "r").read() + @dataclass class CLData(): username: str @@ -40,15 +45,11 @@ class CLData(): def generate_pdf(self): import threading unique_id = get_unique() - root_dir = os.path.dirname(os.getcwd()) - proj_dir = root_dir + '/undercover/' - output_dir = proj_dir + 'outputs/' - unique_file = output_dir + unique_id + ".tex" f = open(unique_file, "w") for pair in self.get_pairs(): f.write("\\def \\" + pair[0] + "{" + pair[1] + "}\n") - f.write(open(proj_dir + "/writing_templates/base.tex", "r").read()) + f.write(base_tex_text) f.close() output_arg="-jobname=outputs/" + unique_id + " " + unique_file