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

Breaking change in lxml 5.0.0 #157

Open
M0WUT opened this issue Jan 1, 2024 · 4 comments
Open

Breaking change in lxml 5.0.0 #157

M0WUT opened this issue Jan 1, 2024 · 4 comments

Comments

@M0WUT
Copy link

M0WUT commented Jan 1, 2024

Found as part of using kikit. Running pcbdraw plot --vcuts=Cmts.User --side=front <path-to-pcb> <path-to-png-out> completes successfully with lxml 4.9.3 installed. Upgrading lxml to 5.0.0 (which was released on 29th December2023) gives the following:

Traceback (most recent call last):
File "/home/runner/.local/bin/pcbdraw", line 8, in
sys.exit(run())
File "/usr/lib/python3/dist-packages/click/core.py", line 1128, in call
return self.main(*args, **kwargs)
File "/usr/lib/python3/dist-packages/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/usr/lib/python3/dist-packages/click/core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/lib/python3/dist-packages/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/home/runner/.local/lib/python3.10/site-packages/pcbdraw/ui.py", line 180, in plot
image = plotter.plot()
File "/home/runner/.local/lib/python3.10/site-packages/pcbdraw/plot.py", line 1052, in plot
self._setup_document(self.render_back, self.mirror)
File "/home/runner/.local/lib/python3.10/site-packages/pcbdraw/plot.py", line 1311, in _setup_document
self._document = empty_svg(
File "/home/runner/.local/lib/python3.10/site-packages/pcbdraw/plot.py", line 394, in empty_svg
document = etree.ElementTree(etree.fromstring(
File "src/lxml/etree.pyx", line 3265, in lxml.etree.fromstring
File "src/lxml/parser.pxi", line 1975, in lxml.etree._parseMemoryDocument
File "src/lxml/parser.pxi", line 1855, in lxml.etree._parseDoc
File "src/lxml/parser.pxi", line 1086, in lxml.etree._BaseParser._parseUnicodeDoc
File "src/lxml/parser.pxi", line 618, in lxml.etree._ParserContext._handleParseResultDoc
File "src/lxml/parser.pxi", line 728, in lxml.etree._handleParseResult
File "src/lxml/parser.pxi", line 657, in lxml.etree._raiseParseError
File "", line 1
lxml.etree.XMLSyntaxError: Blank needed here, line 1, column 21

Uninstalling lxml and force installing version 4.9.3 causes it to work again.

Thanks,
Dan

@Electro707
Copy link
Contributor

Can confirm this is an issue.

Trying to investigate for a bit, but I am not familiar with the lxml library

@yaqwsx
Copy link
Owner

yaqwsx commented Jan 2, 2024

We are not alone: python-openxml/python-docx#1302

LXML refuses to parse our empty SVG template:

PcbDraw/pcbdraw/plot.py

Lines 396 to 404 in 0a137fe

document = etree.ElementTree(etree.fromstring(
"""<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
width="29.7002cm" height="21.0007cm" viewBox="0 0 116930 82680 ">
<title>Picture generated by PcbDraw </title>
<desc>Picture generated by PcbDraw</desc>
</svg>"""))

It complains that a space is missing before standalone... which there is. I haven't been able to identify the root cause at the moment.

@ofaurax
Copy link

ofaurax commented Jan 15, 2024

It should work if you remove the standalone="no"

@ofaurax
Copy link

ofaurax commented Jan 15, 2024

I reported it here: https://gitlab.gnome.org/GNOME/libxml2/-/issues/661

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

4 participants