Open mattijn opened 7 years ago
Is this issue going to be addressed somehow? I am still having it.
first_page = Document.from_xml(layout_path.read_bytes()).first_page()
File "C:\Users\tasty\Anaconda3\lib\site-packages\semantics_core\document.py", line 537, in from_xml
doc = untangle.parse(xml)
File "C:\Users\tasty\Anaconda3\lib\site-packages\untangle.py", line 176, in parse
if is_string(filename) and (os.path.exists(filename) or is_url(filename)):
File "C:\Users\tasty\Anaconda3\lib\genericpath.py", line 19, in exists
os.stat(path)
ValueError: stat: path too long for Windows
Unfortunately I have no way to test on Windows right now.
Hi @stchris - I've experimented with this issue on Windows 10 (after experiencing it myself) and can confirm that this occurs within the os.path.exists
call if the string has ≥ 2^15 (or 32768) characters.
I've raised a PR to address the issue, however rather than hard-coding a present length for checking against, I simply used the try-except technique mentioned by @int19h.
Hope this helps!
Thank you all for your input and sorry for taking so long to respond. First of all I moved to Github Actions in #82 , so at least running unit tests on Windows is now again possible. Second of all I would like to address the fix by providing three separate functions instead of parse
which then does some magic. I outlined a proposal in #87 and am looking for input.
Oftenly with long XML strings it won't parse using the command
untangle.parse(xmlstring)
So, to make this work I first convert the string to an element tree, save it as a temp file and read the file like
untangle.parse(xmlfile)
Not sure if this is the way to go. Once I got the xml in an element tree I could access the objects I want, but I like the untangle framework more. Therefor submitting this issue