This project has moved and is read-only. For the latest updates, please go here.

Google App Engine debugging

Jul 15, 2011 at 7:47 AM


I found this discussion while searching for information on how to use Python Tools for Google App Engine development.

I have been unable to get debugging to work using VS 2010, PTVS RC1 and App Engine SDK 1.5.1. Running without debugging works fine, but as soon as I hit F5, I get the following exception:

"google.appengine.dist.py_zipimport.ZipImportErrorTraceback (most recent call last):  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\dist\", line 123, in __init__    raise ZipImportError(msg)ZipImportError: Non-file 'C:\\Program Files (x86)\\Google\\google_appengine\\lib\\yaml\\lib\\yaml' found for 'C:\\Program Files (x86)\\Google\\google_appengine\\lib\\yaml\\lib\\yaml'"

If I choose "break" here, I can use the debugger to analyze the code in the file, and doing so, I can determine that the error comes from this statement:


    if not os.path.isfile(archive):
      msg = 'Non-file %r found for %r' % (archive, path_entry)

      raise ZipImportError(msg)


The variable "archive" has the value "C:\\Program Files (x86)\\Google\\google_appengine\\lib\\yaml\\lib\\yaml" - which is not a file, but a directory.


I would be very grateful if anyone (joxn?) could try to build the "helloworld" example as per the discussion link above, with the current versions of PTVS and AppEngine, and see if they run into the same issue.

Any help is greatly appreciated.


Jul 15, 2011 at 4:31 PM

I'll take a look at this, but I expect that you should be able to "continue" past this exception. Alternatively, you can start the google appengine server outside of PTVS, open the project with your code in it, and use Debug->Attach To Process to attach to the python instance that's hosting appengine. (Be sure to use Python debugging when you attach.) 

Jul 15, 2011 at 8:33 PM

The root cause here is that Google has replaced zipimport with their own py_zipimport module, and they are raising their own custom google.appengine.dist.py_zipimport.ZipImportError exception (rather than zipimport.ZipImportError). Since a custom exception is being raised but then not caught, we helpfully break for you.  Since it is a custom exception, we don't have a way for you to tell us to ignore it, even though in this context it will be ignored.

You should be able to just hit "Continue" a bunch of times. The exceptions are harmless and appengine will start. We'll take a look at whether or not we can dynamically ignore user-defined exceptions (maybe by allowing you to ignore their parent type?) but that is a pretty big feature and probably won't make it to 1.0.

Jul 18, 2011 at 9:15 PM

Okay, here is a fix for you:

The first time you hit the exception in the debugger, click "Break". Open up Debug->Exceptions, click "Add". Select "Python Exception".  Paste in the exact name of the exception you want to ignore, namely google.appengine.dist.py_zipimport.ZipImportError and click "OK". Make sure this exception is unchecked in the Exceptions dialog box (it defaults to checked), and click "OK".  In the debugger, do Debug->Continue (or press F5). The project should begin executing and skip breaking at all the other places the ZipImportError is thrown.

Aug 11, 2011 at 9:02 AM

Thank you very much for a detailed explanation of the cause and a fully acceptable solution to my issue. Much appreciated!