title: Why does this Python file (which parses XML and validates) work on Windows but not on Mac OS?
body: <p>I've been helping some students with a Python class this fall, and I've noticed that several students using Mac OS to complete a particular assignment involving validating XML against XSD's are running into OS Errors (&quot;Error reading file: failed to load eternal entity [the xml file]&quot;). Their code works perfectly fine on my end (Windows) but on Mac OS it refuses to.</p>
  <p>Here is the code that is causing the problem:</p>
  <pre><code>from lxml import etree
  
  xmlschema_doc = etree.parse(&quot;the_xsd.xsd&quot;)
  xmlschema = etree.XMLSchema(xmlschema_doc)
  doc = etree.parse(&quot;the_xml.xml&quot;)
  print(xmlschema.validate(doc))
  </code></pre>
  <p>In particular, the line <code>doc = etree.parse(&quot;the_xml.xml&quot;)</code> is where the error occurs.</p>
  <p>I've made sure the students 1) have all their files (XML, Python, XSD) in the same folder, 2) I've suggested they use the full filepaths and 3) I found this bit of code and suggested they try it (to no avail):</p>
  <pre><code>prog_dir = os.path.abspath(os.path.dirname(__file__))
  os.chdir(prog_dir)
  </code></pre>
  <p>Again: the XML validates against the XSD on Windows just fine, but on their Macs they get the error.</p>
  <p>Any insights would be much appreciated.</p>