GAE 1.7.7 PyDev debug problem

By Michael Kariv

  1. This document is published under this link:
  2. Short:
  1. I suggest for questions and suggestions to use StackOverflow thread

The problem

  1. Working with Eclipse, debugging with PyDev, setting a breakpoint on one’s app (e.g. in, debugger does not stop at a breakpoint
  2. The problem was reported in a number of forums
  1. The workarounds suggested
  1. use
  2. don’t use breakpoints
  3. don’t use GAE at all
  1. I am kidding here but the first two workarounds were indeed propsed.

The hope

  1. Brain Quilan, a project member, posted his instructions on how to get PyDev work
  1. post in these  threads:
  1. post on March 11
  1. instructions document:
  3. aka
  1. here is the important quotes from Brian Quilan
  1. I've started working on this and have written up a description of how I expect it to work:
  2. pdb doesn't work
  3. I have a prototype that works with Komodo IDE, PyDev, PyCharm
  4. I should add that the document that I linked in my last message is meant for tool providers, not end users. Hopefully tool provides will provide integration using these hooks without any the user have to know how they work.
  5. We have hooks in place to make it possible to add debugger support. It is up to tool vendors now to make use of them.
  1. So important things are 2 IMHO:
  1. It can be made to work here and now, Brian says he has a working prototype for DyDev
  2. In the future it will be made easy by the tool makers (PyDev makers), at least that is Brian’s plan.

Where I am trying to make it work

  1. I, Michael Kariv, am working to implement Brian’s instructions

Starting dev_appserver from eclipse

  1. In Eclipse I created a debug configuration for my project.
  2. Here are my arguments passed to
  3. An observation: breakpoints DO WORK if you set them in dev_appserver python code somewhere before an instance starts for your app.
  1. It does not help a developer but proves that PyDev debugger works fine in general.
  1. My pydevd_startup is indeed called just fine.
  1. It is impossible to set a breakpoint there
  2. The way I verified it being called is outputing a dummy print to a file
  1. I might have errors in my --python_startup_args={"port":7999
  1. JSON parsing was complaining
  2. I don’t care about it because I modded Brian’s code to not read the port from configuraiton. I hard coded port into the script. Not good for a tool vendro, good enough for me trying to make things work.
  1. Here is my code

import json, sys

pydev_path = r'C:\Users\kariv\.eclipse\org.eclipse.platform_4.2.0_1709980481\plugins\org.python.pydev_2.7.3.2013031601\pysrc'


import pydevd

pydevd.settrace('localhost', port=5678, stdoutToServer=False, stderrToServer=True)

  1. Notice is it much simpler that what Brian suggests in the document. I ignore port and other params. Taking care of the niceties like that will come later
  1. However within my hooked script I am unable to connect to pydev
  1. Debugger startup failed: [Errno 10061] No connection could be made because the target machine actively refused it
  1. Same thing happens for either port : 7999, 5678
  2. I suspect I miss a step. Someone needs to be listening on that port. Who?
  3. Trying now
  1. Obviously it is PyDev remote debugger
  3. Beware when you follow their instructions. Item 1 - clicking on a button - buttons are only visible in teh Debug mode. It is puzzling because Item 2 is - switch to Debug mode :). Someone was smoking something when writing this
  1. I managed to hit a breakpoint in my hook script.
  2. However trying to debug leads to wierd conflicts. I suspect I can not run from pydev the dev_appserver. I think I need to run it from command line, using Eclipse/Pydev to remotely connect to an instance.

Starting dev_appserver from command line

  1. I do it the other way around now, and it makes sense to me, but still does not work.
  2. I start dev_appserver from a batch file that looks like Brian’s except it is all Windows bat file syntax ^

--port=8080 ^

--admin_host=localhost ^

--admin_port=8000 ^

--dev_appserver_log_level=debug ^

--python_startup_script="c:\\Data\\cooknotebook\\tools\\" ^

--storage_path="c:\\Data\\datastore\\" ^

--max_server_instances="default:1" ^

--python_startup_args="{""port"": 5678}" ^

--automatic_restart=no ^


  1. Here are my steps
  1. Start debug server for remote debugging from within eclipse,
  1.  following instructions here
  1. Once I start debug server, I see in Eclipse Console Debug Server:
  1. Debug Server at port: 5678

  1. Start dev_appserver from a batch file
  2. make a call to the localhost:8080
  1. either using a browser or
  2. using a fiddler2
  1. What I see is
  1. All the logging.* prints now go to Windows console from which I started the dev_appserver
  2. I stop within my hook script at the like dydevd.settrace as if there was a breakpoint
  3. I click to continue
  4. I see logging.* prints in Console within Eclipse !
  5. Unfortunately breakpoints still dont work


© 2013 Michael Kariv        GAE 1.7.7 PyDev debug problem Notes