bowtie
bowtie copied to clipboard
Running `bowtie suite` on Windows, gives `empty-report` error
I'm not surprised it doesn't work unfortunately -- getting the CI test job to also run on Windows would be a good first step for this!
There's a branch here where I tried to start doing so but ran out of energy -- you could revive that!
Well I am not really sure where the error originates from 😅. Do you have any starting point for me ?
PS. So far I was working on Gitpod. Ran out of credits :(
Running bowtie info on Windows works though
PS. So far I was working on Gitpod. Ran out of credits :(
Well another good issue is to add support for GitHub codespaces then :)
Well I am not really sure where the error originates from 😅. Do you have any starting point for me ?
It's coming from the code which parses JSON Schema test suite URLs, which is here.
There's some likely minor path separator issue it would seem.
It also should work if you clone the repo locally and pass the directory.
Hello @Julian I was trying to debug this and there was no error in the _relative_to method you had pointed to and really it seemed to be an error with the below line specifically zipfile.Path() on Windows:
with zipfile.ZipFile(data) as zf:
(contents,) = zipfile.Path(zf).iterdir()
when I replaced the above logic with below the command worked smoothly!
with tempfile.TemporaryDirectory() as tmp_dir:
zf.extractall(tmp_dir)
(contents,) = Path(tmp_dir).iterdir()
I also found a Stack Overflow thread that mentions zipfile throwing similar errors as in my screenshots on Windows. Here:- https://stackoverflow.com/questions/52090833/python-zipfile-does-not-unzip-folders-for-windows-zip-archive
Do you approve of these changes ? Can it potentially lead to any space issues if we try temporarily extracting as in my changes ?
Are you saying you get the error you mentioned with any Zipfile on windows? Or if not, have you downloaded the one we download and that that's code you ran that worked?
Are you saying you get the error you mentioned with any Zipfile on windows?
I am not sure about any Zipfile on Windows but definitely when we do this zipfile.Path(zf) it doesn’t work on Windows
Or if not, have you downloaded the one we download
I have just did pip install -r requirements.txt so I assume it downloads the same version as in the code repo. But will recheck the version once
that's code you ran that worked
yes the code block change I mentioned above worked for me on Windows
I'm saying "try doing what bowtie does completely outside of bowtie", just download the zip Bowtie downloads, and show me a minimal reproducer of the bug, and then what the fix is.
Okay @Julian I explicitly downloaded the zip in the root directory that Bowtie tries to download before running the command (so the zip was already present) and still got this set of errors from zipfile:
but when I changed the code to this:
with zipfile.ZipFile(data) as zf:
with tempfile.TemporaryDirectory() as tmp_dir:
zf.extractall(tmp_dir)
(contents,) = Path(tmp_dir).iterdir()
cases, dialect = self._cases_and_dialect(path=contents / path)
cases = list(cases)
it worked!
That looks like it still uses Bowtie. Again -- what I mean is can you show me a plain Python program with no dependencies, and some Python code that produces that traceback, given a zip file on Windows?
Okay @Julian got it. Will revert back in a few minutes.
Well I simply tried doing
import zipfile
zipfile_path = './JSON-Schema-Test-Suite-main.zip'
with zipfile.ZipFile(zipfile_path, 'r') as zip_ref:
(contents,) = zipfile.Path(zip_ref).iterdir()
print(contents)
in a plain Python program it didn't seem to throw that error in this case 😅. But then again I am not sure why the temporarily extracting logic I tried to do above worked in Bowtie.
@Julian, closing this issue as I am not facing this error anymore on my Windows machine though I would like to know what really fixed it but thanks anyways!.