title: Debugging GAE in Python Tools for Visual Studio
body: <p>I'm able to run my Google App Engine webapp2 app using <a href="http://pytools.codeplex.com/" rel="noreferrer">Python Tools for Visual Studio</a> 2012 without issues after following <a href="http://4a47.blogspot.ca/2012/11/debugging-python-in-google-app-engine.html" rel="noreferrer">this tutorial</a>, and even step through the server initialization code, but I can't get it to break at get or post methods when the website is loaded, similar to what is shown in <a href="http://www.youtube.com/watch?v=-PcrSD1AwwQ&amp;t=10m" rel="noreferrer">this video</a> with the <code>main()</code> method.  When I pause the debugger, it always ends up in the following infinite loop in wsgi_server.py:</p>
  
  <pre><code>def _loop_forever(self):
    while True:
    self._select()
  
  def _select(self):
    with self._lock:
      fds = self._file_descriptors
      fd_to_callback = self._file_descriptor_to_callback
  if fds:
    if _HAS_POLL:
      # With 100 file descriptors, it is approximately 5x slower to
      # recreate and reinitialize the Poll object on every call to _select
      # rather reuse one. But the absolute cost of contruction,
      # initialization and calling poll(0) is ~25us so code simplicity
      # wins.
      poll = select.poll()
      for fd in fds:
        poll.register(fd, select.POLLIN)
      ready_file_descriptors = [fd for fd, _ in poll.poll(1)]
    else:
      ready_file_descriptors, _, _ = select.select(fds, [], [], 1)
    for fd in ready_file_descriptors:
      fd_to_callback[fd]()
  else:
    # select([], [], [], 1) is not supported on Windows.
    time.sleep(1)
  </code></pre>
  
  <p>Is it possible to set breakpoints in a Google App Engine webapp2 app in PTVS, which are triggered when the page is loaded from localhost?  </p>
  
  <p>Edit: using cprcrack's settings, I was able to successfully run GAE, but when loading the main page I get the error</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 3003, in _HandleRequest
      self._Dispatch(dispatcher, self.rfile, outfile, env_dict)
    File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2862, in _Dispatch
      base_env_dict=env_dict)
    File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 719, in Dispatch
      base_env_dict=base_env_dict)
    File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1797, in Dispatch
      self._module_dict)
    File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1648, in ExecuteCGI
      app_log_handler = app_logging.AppLogsHandler()
    File "C:\Python\lib\logging\__init__.py", line 660, in __init__
      _addHandlerRef(self)
    File "C:\Python\lib\logging\__init__.py", line 639, in _addHandlerRef
      _releaseLock()
    File "C:\Python\lib\logging\__init__.py", line 224, in _releaseLock
      _lock.release()
    File "C:\Python\lib\threading.py", line 138, in release
      self.__count = count = self.__count - 1
    File "C:\Python\lib\threading.py", line 138, in release
      self.__count = count = self.__count - 1
    File "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Python Tools for Visual Studio\2.0\visualstudio_py_debugger.py", line 557, in trace_func
      return self._events[event](frame, arg)
    File "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Python Tools for Visual Studio\2.0\visualstudio_py_debugger.py", line 650, in handle_line
      if filename == frame.f_code.co_filename or (not bound and filename_is_same(filename, frame.f_code.co_filename)):
    File "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Python Tools for Visual Studio\2.0\visualstudio_py_debugger.py", line 341, in filename_is_same
      import ntpath
    File "C:\Python\lib\ntpath.py", line 8, in &lt;module&gt;
      import os
    File "C:\Python\lib\os.py", line 120, in &lt;module&gt;
      from os.path import (curdir, pardir, sep, pathsep, defpath, extsep, altsep,
  ImportError: cannot import name curdir
  </code></pre>
  
  <p>Is this error occurring because I need to roll back to Python 2.5 to use the old dev_appserver?  </p>