On 7/14/10 10:49 AM, Paul McNett wrote:
> On 7/14/10 10:42 AM, Jacek Kałucki wrote:
>> Użytkownik Paul McNett napisał:
>>>> It seems like first attribute was object instance, not a class.
>>>> Look at this:
>>>>
>>>>    raise Exception('foo'), 'what now?'
>>>>
>>>> versus this:
>>>>
>>>>    raise Exception('foo', 'what now?')
>>>>
>>>>
>>> So something somewhere has changed dabo.dException.NoRecordsException from 
>>> a class
>>> into an instance?
>>>
>>
>> I doubt it, but maybe Python misinterpreted first attribute.
>> Did you try other platform or Python version (e.g. 2.6)?
>> Maybe you could put an breakpoint in this line and watch what happens.
>
> Problem is that this happened only for one customer out of many. I can't 
> repro on my
> end.

Was finally able to reproduce on my end, and found the error. I've been bitten 
by 
this before but unfortunately my except block in this case only fires very 
rarely and 
I never hit it in my testing. Here's what I was doing:

133     try:
134       if lookup.getFieldVal(lookup.KeyField) != val:
135         lookup.moveToPK(val)
136       return self.DisplayFormat % 
lookup.getDataSet(rowStart=lookup.RowNumber, 
rows=1)[0]
137     except dabo.dException.RowNotFoundException, 
dabo.dException.NoRecordsException:
138       return self.Application.NoneDisplay

Line 137 wants to catch two possible exceptions, not use 
dabo.dException.NoRecordsException as the instance exception object! So that 
line 
should be:

137     except (dabo.dException.RowNotFoundException, 
dabo.dException.NoRecordsException):

In my case it was other code in the same stackframe that was catching 
NoRecordsException, and *that* code was complaining about "instance exception 
may not 
have a separate value", because dabo.dException.NoRecordsException was (during 
this 
stackframe at least) a dabo.dException.RowNotFound instance!

Python programs are usually very easy to debug, but this one had me flummoxed! 
It was 
difficult for me to find even after I could finally reproduce the error this 
morning...

Anyway I wanted to follow up on this since it was still open.

Paul
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[email protected]

Reply via email to