in Docker while parsing: XMLSyntaxError: Document is empty
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lxml |
New
|
Undecided
|
Unassigned |
Bug Description
This script fails in any docker container i tried (ubuntu, alpine, ol8) but runs fine on mac locally. seems like its libxml2 2.9.14 version issue.
from requests import get
from lxml import etree
r = get('https:/
with open('test.xml', 'wb') as f:
f.write(
lines = []
tree = etree.iterparse
try:
for (ev, el) in tree:
finally:
print(
===== docker python3.10-slim (ol8) conf:
Python : sys.version_
lxml.etree : (4, 9, 1, 0)
libxml used : (2, 9, 14)
libxml compiled : (2, 9, 14)
libxslt used : (1, 1, 35)
libxslt compiled : (1, 1, 35)
===== docker python3.10-slim (ol8) eror:
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "src/lxml/
File "src/lxml/
File "src/lxml/
File "src/lxml/
File "src/lxml/
File "src/lxml/
File "src/lxml/
File "src/lxml/
File "test.xml", line 1
lxml.etree.
===== docker ubuntu:latest conf:
Python : sys.version_
lxml.etree : (4, 9, 1, 0)
libxml used : (2, 9, 14)
libxml compiled : (2, 9, 14)
libxslt used : (1, 1, 35)
libxslt compiled : (1, 1, 35)
===== docker ubuntu:latest error:
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "src/lxml/
File "src/lxml/
File "src/lxml/
File "src/lxml/
File "src/lxml/
File "src/lxml/
File "src/lxml/
File "src/lxml/
File "test.xml", line 1
lxml.etree.
===== and finally mac conf that works fine locally:
Python : sys.version_
lxml.etree : (4, 9, 1, 0)
libxml used : (2, 9, 13)
libxml compiled : (2, 9, 13)
libxslt used : (1, 1, 35)
libxslt compiled : (1, 1, 35)
maybe i can downgrade libxml2 version somehow?
this file only works on my macs somehow, but not in any containers even with libxml2 2.9.13