Search code examples
pythonmysqltry-catchpeewee

Python - peewee - Debugging statements - where are the errors logged


I have just started to use peewee in python. But as i am saving table data using .save() function. There is an error in the line. and control does not go to the next line.

Just wanted to know how can know what the error is. Although i have narrowed down to the line as below

     try:
        with database.transaction():
            driver = Driver()
            driver.person = person
            driver.qualification = form.getvalue('qualification')
            driver.number = form.getvalue('phone')
            driver.license = form.getvalue('issu')
            driver.audited_by = 0
            print "this line prints"
            driver.save()
            print "this one does not print"
            print "Success"

    except:
        print "Error"

I have used print statements i was able to figure out the error in in the line driver.save(). But how to check what exactly is the error?


Solution

  • This is specified in the peewee documentation here.