[XML-SIG] Pyexpat error handling

uche.ogbuji@fourthought.com uche.ogbuji@fourthought.com
Mon, 07 Feb 2000 17:10:27 -0700


> >>> from pyexpat import ParserCreate
> >>> p=ParserCreate()
> >>> p.StartElementHandler=lambda x:x
> >>> p.ParseFile( open( "../hamlet.xml" ) )
> Traceback (innermost last):
>   File "<stdin>", line 1, in ?
> TypeError: too many arguments; expected 1, got 2
> 
> You see how it looks like it was the ParseFile that had too many
> arguments but really it was the call to the callback. I'm not sure of
> the best way to make this more clear. Perhaps add a bogus traceback
> entry???

If I'm following correctly, we often run into this problem with C/Python 
call-backs.  We usually pass back an error-code that we can use to generate a 
custom exception.  I suppose adding a traceback entry would be another 
approach.  I'm curious as to how well that would work.

-- 
Uche Ogbuji
Fourthought, Inc., IT Consultants
uche.ogbuji@fourthought.com	(970)481-0805
Software-engineering, project-management, knowledge-management
http://Fourthought.com		http://OpenTechnology.org