KeyError: '__main__' #279

egasimus opened this Issue Apr 30, 2012 · 8 comments


None yet

8 participants


I set up django-debug-toolbar according to the instructions, but now I get a KeyError on every page instead:

Running locally with Google App Engine SDK.


I have the same problem! no solution yet?

I noticed that I got this error just when I declare the INTERNAL_IPS = ('',), if I comment this line I don't get this error, but the toolbar also doesn't show.

I'm running locally with Google App Engine SDK 1.6.6


At file debug_toolbar/utils/ at line 127, change this:

         except (IOError, IndexError):

into this:

        except (IOError, IndexError, KeyError):

Should be enough.


@herberthamaral That change doesn't solve the problem because the exception is trigger outside that "try" block. I'm having the same problem using Google App Engine SDK 1.7.0. I guess that the problem is related to be using GAE.


I see. Well, it worked for me. Sadly, I'm not using the latest version of the SDK.

ecabuk commented Sep 8, 2012

except (IOError, IndexError, KeyError):

Worked for me, I am using latest version of GAE sdk


Worked on google appengine 1.7.2.


I am using google app engine sdk 1.7.7 with django 1.4 and I get this error. Using @herberthamaral 's suggestion fixed the problem, but I haven't checked the implications of it.


Thank you, herberthamaral, works fine for me with GAE 1.8.1 / Django 1.5.1.

@aaugustin aaugustin closed this in 0bd0abd Oct 15, 2013
@jwg4 jwg4 referenced this issue in acoomans/flask-autodoc Jan 11, 2016

gae keyerror main #23

@ryneeverett ryneeverett pushed a commit to ryneeverett/django-debug-toolbar that referenced this issue Oct 2, 2016
@aaugustin aaugustin Catch exceptions liberally when looking for sources.
Fix #279.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment