Python seems to be ignoring my except clause...

Adam W. AWasilenko at gmail.com
Tue Feb 19 09:14:14 EST 2008


On Feb 19, 8:49 am, Duncan Booth <duncan.bo... at invalid.invalid> wrote:
> The example you posted isn't complete and while I can easily expand it to a
> working example it will unfortunately be a working example.
>
> Try cutting it down yourself to a minimal self-contained example that you
> can post. 99% of the time you'll find the problem when you do that and
> avoid having to post at all.
>
> In this case, judging by the stack backtrace quoting the wrong line, I'd
> guess you only just added the try..except and for some reason are still
> executing the old code without the exception handling.- Hide quoted text -
>
> - Show quoted text -

You hit the nail on the head with the old code, I found it funny
myself it was quoting the try statement and not the code within.  So I
deleted my .pyc files and reran, same thing, but then I closed all
open windows and reran it, and it recompiled the pyc and the code
"worked".  But now there is a new problem.  I added a print statement
to the except clause to make sure it was executing, and something
funny happen, it printed 3 times and then spat this out:

  File "C:\Users\Adam\Desktop\XMLWorkspace.py", line 72, in parsexml
    parse(url, FeedHandlerInst)
  File "C:\Python25\lib\xml\sax\__init__.py", line 33, in parse
    parser.parse(source)
  File "C:\Python25\lib\xml\sax\expatreader.py", line 107, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File "C:\Python25\lib\xml\sax\xmlreader.py", line 123, in parse
    self.feed(buffer)
  File "C:\Python25\lib\xml\sax\expatreader.py", line 211, in feed
    self._err_handler.fatalError(exc)
  File "C:\Python25\lib\xml\sax\handler.py", line 38, in fatalError
    raise exception
SAXParseException: http://revision3.com/systm/feed/wmv-large/:78:83:
undefined entity

Huh?  Why did it not raise this BEFORE it attempted to append the
string, why did my print statment print 3 times before this error?  I
think I got past the hump I was hitting, and found a new one, 3 items
later, I will investigate.  But now I know I have to keep deleting my
pyc files or else I will run into trouble.



More information about the Python-list mailing list