The problem is that when you catch an OperationalError, you must rollback. 
Else the database does not allow commit anymore.

On Sunday, 8 July 2012 22:55:43 UTC-5, Janath wrote:
>
> It worked :) Thank you
>
> On Sunday, July 8, 2012 6:47:59 PM UTC-5, Massimo Di Pierro wrote:
>>
>> try:
>>
>> except: #catch all
>>    db.rollback()
>>    .....
>>
>> On Sunday, 8 July 2012 17:39:46 UTC-5, Janath wrote:
>>>
>>> Hi,
>>>
>>> I populate a database table by a csv file.
>>>
>>> In run time, if the user tries to upload a file having different format 
>>> to the table. A sqllite operational error is detected.
>>>
>>> In that case I need to inform the user that the file has invalid format.
>>>
>>> I tried with
>>>
>>> try:
>>>     
>>>             
>>> except RuntimeError:
>>>             response.flash='Error'
>>>             return dict(form=form)
>>>
>>>
>>> I'm unable to catch the error... I have attached the error report
>>>
>>> Plase advice as to how I can avoid a run time error and display a 
>>> message instead.
>>>
>>> Thank you
>>>
>>>
>>>

Reply via email to