LukeCarrier / mkdocs-drawio-exporter

Exports your Draw.io diagrams at build time for easier embedding into your documentation
https://pypi.org/project/mkdocs-drawio-exporter/
MIT License
81 stars 9 forks source link

Empty document crashes build #8

Closed beddari closed 4 years ago

beddari commented 4 years ago

Hi, this might be per design currently, but referring to an empty tab in a multipage document causes a crash

Error: Export failed: /docs/content/technical/network/site_design.drawio
ERROR   -  Output file not created in cache 
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/mkdocsdrawioexporter/plugin.py", line 85, in on_post_build
    copy_file(cache_filename, abs_dest_path)
  File "/usr/local/lib/python3.7/site-packages/mkdocs/utils/__init__.py", line 100, in copy_file
    shutil.copyfile(source_path, output_path)
  File "/usr/lib64/python3.7/shutil.py", line 120, in copyfile
    with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: '/docs/content/cache/9a7d5d6802558d95399cdc2f0d36a830a92be749-3'

As a workaround I could just put some object in the tab but ... I think as a user I'd expect an empty tab to just produce empty output, somehow?

beddari commented 4 years ago

Verified that this applies to empty documents over all.

LukeCarrier commented 4 years ago

Great catch @beddari, thanks for troubleshooting. I guess Draw.io emits no output file if the tab is empty, so we should probably catch the copy failing and emit a warning. I'll get on this early next week.