lxml tostring() returns blank string in Flask running on mod-wsgi
问题 I have a Python 2.7.6 Flask application that is trying to parse a SAML XML document using the lxml library. I'm running into an issue where etree.tostring(...) returns an empty string. etree_string = etree.tostring(etree.fromstring(b'<test1><test2></test2></test1>')) return etree_string # output: '' This appears to only occur when the code is run within the Flask app, served by mod_wsgi in Apache. I say this because in the same virtualenv, if I open a python interpreter and run: >>> etree