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(' ') if len(request.POST['timeToRun']) <= 0: timeToRun = Job.objects.filter(id=jobIDs[i]).values()['whenToRun'].split(' ') 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?
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