Skip to content

Commit 0c83c9f

Browse files
committed
🐛 fix #89 - check if output was actually created
1 parent 283e09a commit 0c83c9f

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

gui/app.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ def inner():
119119
"Success",
120120
"Report generation completed successfully." f"\nLogs at {log_file}",
121121
)
122+
print_completion_message(report_type.get())
122123
except Exception as e:
123124
stacktrace = traceback.format_exc()
124125
messagebox.showerror(

src/vuegen/quarto_reportview.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ def run_report(self, output_dir: str = BASE_DIR) -> None:
168168
"""
169169
# from quarto_cli import run_quarto # entrypoint of quarto-cli not in module?
170170

171-
file_path_to_qmd = str(Path(output_dir) / f"{self.BASE_DIR}.qmd")
172-
args = [self.quarto_path, "render", file_path_to_qmd]
171+
file_path_to_qmd = Path(output_dir) / f"{self.BASE_DIR}.qmd"
172+
args = [self.quarto_path, "render", str(file_path_to_qmd)]
173173
self.report.logger.info(
174174
f"Running '{self.report.title}' '{self.report_type}' report with {args!r}"
175175
)
@@ -191,8 +191,13 @@ def run_report(self, output_dir: str = BASE_DIR) -> None:
191191
args,
192192
check=True,
193193
)
194+
out_path = file_path_to_qmd.with_suffix(f".{self.report_type.lower()}")
195+
if self.report_type in [r.ReportType.REVEALJS, r.ReportType.JUPYTER]:
196+
out_path = file_path_to_qmd.with_suffix(".html")
197+
if not out_path.exists():
198+
raise FileNotFoundError(f"Report file could not be created: {out_path}")
194199
if self.report_type == r.ReportType.JUPYTER:
195-
args = [self.quarto_path, "convert", file_path_to_qmd]
200+
args = [self.quarto_path, "convert", str(file_path_to_qmd)]
196201
subprocess.run(
197202
args,
198203
check=True,
@@ -208,11 +213,11 @@ def run_report(self, output_dir: str = BASE_DIR) -> None:
208213
f"Error running '{self.report.title}' {self.report_type} report: {str(e)}"
209214
)
210215
raise
211-
except FileNotFoundError as e:
212-
self.report.logger.error(
213-
f"Quarto is not installed. Please install Quarto to run the report: {str(e)}"
214-
)
215-
raise
216+
# except FileNotFoundError as e:
217+
# self.report.logger.error(
218+
# f"Quarto is not installed. Please install Quarto to run the report: {str(e)}"
219+
# )
220+
# raise
216221

217222
def _create_yaml_header(self) -> str:
218223
"""

0 commit comments

Comments
 (0)