Thursday, November 8, 2012

Debugging python in Google App Engine with Visual Studio

This guide might not work anymore, try this instead:
http://joesdevnotepad.blogspot.co.at/2014/07/remote-debug-google-app-engine.html

This is what you need, download and install in this order:
  1. Visual Studio 2012
  2. Python  (latest 2.7.? version) 
  3. Python Tools for Visual Studio
  4. Google App Engine SDK for Python
Read the Getting started tutorial when you get to the Hello World example instead of creating a directory,  you just create a "Python Application" project in Visual Studio with the name helloworld, then just continue follow the tutorial and create the files needed in Visual Studio instead.

To be able to run and debug the application from Visual Studio there are some project properties you need to fill in:

General->Startup File: C:\Program Files (x86)\Google\google_appengine\dev_appserver.py
General->Working Directory: ..
General->Interpreter: Python 64-bit 2.7 or Python 32-bit 2.7
Debug->Search Paths: C:\Program Files (x86)\Google\google_appengine;.
Debug->Script Arguments: --use_sqlite helloworld

Start debugging.

You will get a ZipImportError exception.
This exception can be ignored and this is how you do that:
  • Open Debug->Exceptions... 
  • click the Add button.
  • Set type to "Python Exceptions" and in the name field write this:
  • google.appengine.dist.py_zipimport.ZipImportError 
  • click the OK button and uncheck the User-unhandled checkbox
  • click OK and continue execution.
Now you're good to go, enjoy.


References:
PTVS - Setup and Debugging of Google App Engine with Python Tools for Visual Studio

2 comments:

  1. Great. Thanks!

    ReplyDelete
  2. Anonymous20:17

    He, this sadly didn't work anymore, but I got it running in the end. I just leave it here, because I tried forever to google for a solution: http://joesdevnotepad.blogspot.co.at/2014/07/remote-debug-google-app-engine.html

    ReplyDelete