Handle OSError [errno.EINVAL] that might be raised in Windows
Suggested fix posted in https://github.com/wireviz/WireViz/issues/344#issuecomment-2113476151
Please verify that this fixes #344 and report back.
The base branch of this PR is master for the time beeing, but it should be changed to a new release/v0.4.1-rc before any merge-in. #345 should also be fixed and updating the changelog before releasing the hotfix.
This commit fixed it for me 👍
> python -V
Python 3.12.2
> dot -V
dot - graphviz version 11.0.0 (20240428.1522)
> ver
Microsoft Windows [Version 10.0.19045.4291]
pip uninstall wireviz
pip install wireviz
I have replaced wireviz.py with the edited file
->
`PS C:\Users\adam\Wireviz\psyduck\J2_GND> wireviz j2.yml
WireViz 0.4
Input file: j2.yml
Output file: j2.[html|png|svg|tsv]
Traceback (most recent call last):
File "
@freiadam wrote:
[...] "C:\Users\adam\AppData\Local\Programs\Python\Python311\Lib\site-packages\wireviz\wv_helper.py", line 117, in open_file_read return open(filename, "r", encoding="UTF-8") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\adam\AppData\Local\Programs\Python\Python311\Lib\site-packages\wireviz\templates\simple.html'`
Thank you for testing this PR. The exception you report now seems to be caused by the other bug already reported in #345. Please also comment there about your findings if you agree.
The fact that you got an exception trying to read a template file (that is part of HTML output after processing all YAML input) proves that the bug targeted by this PR was not triggered, because the #344 bug is located in the code part that opens the YAML input before it gets parsed. 😃
Same error as Original post.
wireviz-0.4.1.dev0 fixed issue.