views:

41

answers:

2

I'm having an issue with blobstore uploads, but because of the way gae handles all of that, actually figuring out what the error was is giving me some trouble. I'm using django, which unfortunately tries very hard to prevent exceptions from reaching the user without formatting. It looks like the uploads are successful, there are __BlobInfo__ entities in the database, but then something is happening thats causing a 500 response.

Here's what the log says:

INFO     2010-09-29 03:54:33,236 dev_appserver.py:529] Internal redirection to /img/imup/aglwaGFzZS10d29yDQsSB1Byb2plY3QYAgw
INFO     2010-09-29 03:54:33,654 dev_appserver_blobstore.py:328] Upload handler returned 500
ERROR    2010-09-29 03:54:33,654 dev_appserver_blobstore.py:341] Invalid upload handler response. Only 301, 302 and 303 statuses are permitted and it may not have a content body.
INFO     2010-09-29 03:54:33,736 dev_appserver.py:3275] "POST /_ah/upload/aglwaGFzZS10d29yGwsSFV9fQmxvYlVwbG9hZFNlc3Npb25fXxgPDA HTTP/1.1" 500 -

Is there some way to get more useful debug information out of the SDK?

A: 

Well, here's how i'm now making progress. It's kind of icky:

try:
    # something that might not work
except Exception, e:
    return http.httpResponseRedirect('/%s'%repr(e))

and then I can read the error that occured in the URL.

I hope I can accept someone elses (much better) answer, because this is a terrible hack and it's no fun!

TokenMacGuy
Incidentally, as a stopgap measure, simply make the catch clause "logging.exception("Exception occurred while handling blob")" with "raise" on the next line.
Nick Johnson
+1  A: 

The exception your code is raising should be output immediately above the log lines you pasted - scroll up! If it's not, something in your framework is catching exceptions and not reporting them - possibly it's returning them to the user, which is not much use in this scenario.

Nick Johnson
indeed, i'm using django. its' making this quite difficult for this particular case. I'm happy to say that i've worked through the current problem, but its still annoying.
TokenMacGuy
Django should log all exceptions by default, as far as I'm aware.
Nick Johnson
Where do I find that log, or how do I make sure it's enabled?
TokenMacGuy
The same place you got the log lines you pasted in your question. If the exception isn't directly above that, you need to see why Django isn't logging exceptions; I'm not a Django expert, so I can't really help there.
Nick Johnson