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

ElementTree errors on parsing "&" #23

Open
cybertunnel opened this issue Dec 21, 2018 · 6 comments
Open

ElementTree errors on parsing "&" #23

cybertunnel opened this issue Dec 21, 2018 · 6 comments

Comments

@cybertunnel
Copy link

Receive the error: File "/usr/local/lib/python3.6/xml/etree/ElementTree.py", line 1314, in XML parser.feed(text) xml.etree.ElementTree.ParseError: reference to invalid character number: line 35, column 20

While trying to download and/or parse our scripts. It seems to be only breaking on &. I have been doing some research on how to mitigate this. The only thing I could see is to read the XML for each line and handle the & before the ElementTree gets it.

@cybertunnel
Copy link
Author

Figured it out, have to replace any & with &. I will do a PR with my fix :)

@badstreff
Copy link
Owner

I think this issue may already be fixed in the dev branch but not merged in. Can you test the dev branch and see if it is still broken?

@cybertunnel
Copy link
Author

Sure thing, will test now

@cybertunnel
Copy link
Author

It is the same file in tools/, I am looking in the dev branch. Is there another branch the might have this fix?

@badstreff
Copy link
Owner

badstreff commented Jan 24, 2019

Nope, I recall a fix for something similar to this made in the past. Looks like this is still an issue. I'm definitely willing to take you up on that offer for a PR. ;)

@Kurara
Copy link

Kurara commented Sep 21, 2020

Figured it out, have to replace any & with &. I will do a PR with my fix :)

In fact, the library xml doesn't read "&". If you see in its code https://lxml.de/api/xml.etree.ElementTree-pysrc.html line 1061 it escapes "&" before writing it into xml.

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

No branches or pull requests

3 participants