Share

PySablot - Python/Sablotron

The forum address has changed, you have been automatically redirected. Please update any bookmarks to use the new URL.

Subscribe

lack of exception throwing

You are viewing a single message from this topic. View all messages.

  1. 2001-03-09 14:31:34 UTC
    I started experimenting with Sablotron/PySablot just recently, and it's pleasantly fast.
    Thanks for writing the Python interface!

    However, I was surprised to find that it's not throwing python exceptions when a parse error occurs (and perhaps when other errors occur as well).
    For example, say I have a stylesheet with an unclosed element in it. If I run something like the following code:

    xslfile = open('bad.xsl')
    xmlfile = open('good.xml')
    output = PySablot.ProcessStrings(xslfile.read(), xmlfile.read())

    No exception is thrown, but the following is printed to stderr:

    Error [code:2] [URI:arg:/_stylesheet] [line:38]
    XML parser error 7: mismatched tag

    It would be much better (I think) for the error message from Sablot to be thrown as a proper python exception (with the error message text included as an exception argument), so that calling code can catch it (and report the error to the end user, etc).

< Previous | 1 | Next >

Add a Reply

This forum does not allow anonymous participation.

Log in to add a reply. Not registered? Create an account to participate and receive email updates when replies are posted to this topic.