Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what does the error "no exception supplied" mean?

My Django app is currently throwing this error on one of my pages, does anyone know what it eans? I would supply more detail but I don't know what this error means so I'm not sure what the relevant files are and Django apps are rather large in the amount of code spread around so I'll post some code once I can get an idea of what this means. Thanks in advance for any help.

EDIT: I tried capturing the error and printing it like so: EDIT: I've entered the code that's throwing the error

jobIDs is a dict containing all of the IDs of the records I want to modify

for i in jobIDs:  
    dateToRun = request.POST['dateToRun']
    timeToRun = request.POST['timeToRun']  
    try:
        if len(request.POST['dateToRun']) <= 0:
            dateToRun = Job.objects.filter(id=jobIDs[i]).values()['whenToRun'].split(' ')[0]
        if len(request.POST['timeToRun']) <= 0:
            timeToRun = Job.objects.filter(id=jobIDs[i]).values()['whenToRun'].split(' ')[1]
    except BaseException, e:
        print str(e)
    whenToRun = dateToRun + ' ' + timeToRun
    Job.objects.filter(id=jobIDs[i]).update(whenToRun=whenToRun)

This produces a blank line of output (from the print in the except block), am I misunderstanding how to print out the error?

like image 850
avorum Avatar asked Jun 18 '13 19:06

avorum


1 Answers

Are you executing a piece of code that may throw an exception? Perhaps a database query for something that does not exist? If so, you will need to wrap the block of code in a try/except clause. For example, if the exception is indeed a query for something that does not exist:

try: 
    #Block of code that throws exception
except Object.DoesNotExist:
    #Handle error
like image 87
Shaun Singh Avatar answered Sep 19 '22 20:09

Shaun Singh