2

I'm building a basic site with the dev version of Google App Engine(ver 1.9.14.1225) and I can't figure out how to enter the debugger to determine why my template variables are not rendered.

The App Engine documentation says to use: import pdb; pdb.set_trace();

https://cloud.google.com/appengine/docs/python/tools/devserver#Python_Debugging_with_PDB

However, when I inserted pdb into my code, it threw this error:
if self.quitting: raise BdbQuit

How do I enter the pdb debugger?

ERROR    2014-10-30 14:25:16,768 webapp2.py:1552] 
 Traceback (most recent call last):
   File "/Users/Bryan/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 1529, in __call__
     rv = self.router.dispatch(request, response)
   File "/Users/Bryan/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 1529, in __call__
     rv = self.router.dispatch(request, response)
   File "/Users/Bryan/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 1278, in default_dispatcher
     return route.handler_adapter(request, response)
   File "/Users/Bryan/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 1102, in __call__
     return handler.dispatch()
   File "/Users/Bryan/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 570, in dispatch
     return method(*args, **kwargs)
   File "/Users/Bryan/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 570, in dispatch
     return method(*args, **kwargs)
   File "/Users/Bryan/work/GoogleAppEngine/dermalfillersecrets/main.py", line 94, in get
     self.response.write(template.render(template_values))
   File "/Users/Bryan/work/GoogleAppEngine/dermalfillersecrets/main.py", line 94, in get
     self.response.write(template.render(template_values))
   File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/bdb.py", line 49, in trace_dispatch
     return self.dispatch_line(frame)
   File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/bdb.py", line 68, in dispatch_line
     if self.quitting: raise BdbQuit

osX 10.9.5

BryanWheelock
  • 12,146
  • 18
  • 64
  • 109

2 Answers2

1

It looks like there is a known issue with PDB and Mac. I would "star" it to add more weight and comment that you are still seeing the issue.

Looks like it's caused because PDB uses stdin/stdout for i/o and the MAC dev_server doesn't work with them.

Looks like there's a third party tool that should work.

Here it looks like you can re-direct the I/O, I don't have a mac to test where you can re-direct but might be helpful.

There is also this tool to redirect the I/O to a socket. Not sure it will work but thought I would include it just in case.

Community
  • 1
  • 1
Ryan
  • 2,512
  • 1
  • 13
  • 20
1

If you are using the GUI to run your dev server I don't believe you will have access to pdb.

You should try the command line run server for app engine via:

dev_appserver.py myapp

and possibly even the django-server: django-admin runserver

Erik
  • 898
  • 2
  • 8
  • 28