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

ValueError: stat: path too long for Windows #45

Open
mattijn opened this issue Jun 18, 2017 · 4 comments
Open

ValueError: stat: path too long for Windows #45

mattijn opened this issue Jun 18, 2017 · 4 comments

Comments

@mattijn
Copy link

mattijn commented Jun 18, 2017

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

@tastyminerals
Copy link

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

@stchris
Copy link
Owner

stchris commented Nov 18, 2019

Unfortunately I have no way to test on Windows right now.

@Liam-Deacon
Copy link

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!

@stchris
Copy link
Owner

stchris commented Jul 1, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants