lxml include relative path
问题 Using Python's lxml library, I'm trying to load a .xsd as schema. The Python script is in one directory and the schemas are in another: /root my_script.py /data /xsd schema_1.xsd schema_2.xsd The problem is that schema_1.xsd includes schema_2.xsd like this: <xsd:include schemaLocation="schema_2.xsd"/> Being schema_2.xsd a relative path (the two schemas are in the same directory), lxml doesn't find it and it rises and error: schema_root = etree.fromstring(open('data/xsd/schema_1.xsd').read()