Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle OSError [errno.EINVAL] that might be raised in Windows #346

Open
wants to merge 1 commit into
base: release/v0.4.1-rc
Choose a base branch
from

Conversation

kvid
Copy link
Collaborator

@kvid kvid commented May 15, 2024

Suggested fix posted in
#344 (comment)

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.

Suggested fix posted in
wireviz#344 (comment)

Co-authored-by: JarrettR <jrainier@gmail.com>
@nanangp
Copy link

nanangp commented May 16, 2024

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]

@freiadam
Copy link

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 "", line 198, in _run_module_as_main
File "", line 88, in run_code
File "C:\Users\adam\AppData\Local\Programs\Python\Python311\Scripts\wireviz.exe_main
.py", line 7, in
File "C:\Users\adam\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1157, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\adam\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "C:\Users\adam\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\adam\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\adam\AppData\Local\Programs\Python\Python311\Lib\site-packages\wireviz\wv_cli.py", line 141, in wireviz
wv.parse(
File "C:\Users\adam\AppData\Local\Programs\Python\Python311\Lib\site-packages\wireviz\wireviz.py", line 382, in parse
harness.output(filename=output_file, fmt=output_formats, view=False)
File "C:\Users\adam\AppData\Local\Programs\Python\Python311\Lib\site-packages\wireviz\Harness.py", line 708, in output
generate_html_output(filename, bomlist, self.metadata, self.options)
File "C:\Users\adam\AppData\Local\Programs\Python\Python311\Lib\site-packages\wireviz\wv_html.py", line 37, in generate_html_output
html = open_file_read(templatefile).read()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "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'`

@kvid
Copy link
Collaborator Author

kvid commented May 16, 2024

@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. 😃

@kvid kvid mentioned this pull request May 25, 2024
11 tasks
@kvid kvid changed the base branch from master to release/v0.4.1-rc May 25, 2024 16:34
@kvid kvid requested a review from formatc1702 June 1, 2024 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug] OSError: [WinError 123] with version 0.4
3 participants