![](https://secure.gravatar.com/avatar/940e53740f3b99690ebffd1bb205c1de.jpg?s=120&d=mm&r=g)
Hello, I use etree.xmlfile and a coroutine to generate XML into a file-like object that does post-processing on the XML data. Now, if I use the send() method to produce invalid XML data, the post-processor throws an exception. Here, I see a little problem: No matter what exception is thrown by the post-processor, the send() method always generates a generic IO exception. Apparently, lxml catches any exception thrown by the file-like object and produces a generic IO exception in stead. This means that there is no way to know what exactly went wrong in the post-processor. That information is lost. Inside the coroutine, I *do* get the original exception from the post-processor, but doing the error handling there is kind of ugly. Is there a better way to solve this problem? Thanks a lot!