Mar 10 at 10:17 PM
Edited Mar 10 at 10:18 PM
|
Hi,
Yes - the User-unhandled box for the specific exception we're not breaking on is checked.
I am happy to provide sample test code (sorry for long post).
- Create a directory
- Create two files main.py and app.yaml
app.yaml:
application: mytestapp
version: 1
runtime: python27
threadsafe: true
api_version: 1
default_expiration: "5d 12h"
handlers:
- url: /.*
script: main.app
main.py:
import webapp2
class Index(webapp2.RequestHandler):
def get(self):
self.response.out.write('hello world!')
mappings = [('/', 'main.Index')]
app = webapp2.WSGIApplication(mappings)
- Launch VS. Create Python application from existing code.
- Add above two files to the project
- Alt->ENTER->General. Set Startup File to C:\Program Files (x86)\Google\google_appengine\dev_appserver.py
- Alt->ENTER->Debug. Set Script Arguments to directory in step 1
- F5
-
Verify this output in python shell:
INFO 2013-03-10 15:07:15,349 appcfg.py:618] Checking for updates to the SDK.
INFO 2013-03-10 15:07:16,717 appcfg.py:636] The SDK is up to date.
WARNING 2013-03-10 15:07:16,720 dev_appserver.py:3578] The datastore file stub
is deprecated, and
will stop being the default in a future release.
Append the --use_sqlite flag to use the new SQLite stub.
You can port your existing data using the --port_sqlite_data flag or
purge your previous test data with --clear_datastore.
WARNING 2013-03-10 15:07:16,779 simple_search_stub.py:975] Could not read searc
h indexes from c:\users\me\appdata\local\temp\dev_appserver.searchindexes
INFO 2013-03-10 15:07:17,049 dev_appserver_multiprocess.py:656] __Running appl
ication dev~mytestapp on port 8080: http://localhost:8080__
INFO 2013-03-10 15:07:17,052 dev_appserver_multiprocess.py:658] Admin consol
e is available at: http://localhost:8080/_ah/admin
- Open web browser, navigate to http://localhost:8080/
-
Verify web page that says hello world!
Now to break above code to test if debugger is breaking on unhandled exception, simply change
mappings = [('/', 'main.Index')]
to
mappings = [('/', 'Index')]
Now if you refresh the webpage, you will see:
500 Internal Server Error
The server has either erred or is incapable of performing the requested operation.
Python shell will show:
ERROR 2013-03-10 15:10:17,605 webapp2.py:1552] import_string() failed for 'In
dex'. Possible reasons are:
- missing init.py in a package;
- package or module path not included in sys.path;
- duplicated package or module name taking precedence in sys.path;
-
missing module, class, function or variable;
Original exception:
ImportError: No module named Index
Debugged import:
-
'Index' not found.
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2
.py", line 1535, in call
rv = self.handle_exception(request, response, e)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2
.py", line 1529, in call
rv = self.router.dispatch(request, response)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2
.py", line 1272, in default_dispatcher
self.handlers[handler] = handler = import_string(handler)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2
.py", line 1852, in import_string
return import(import_name)
ImportStringError: import_string() failed for 'Index'. Possible reasons are:
-
missing init.py in a package;
- package or module path not included in sys.path;
- duplicated package or module name taking precedence in sys.path;
-
missing module, class, function or variable;
Original exception:
ImportError: No module named Index
Debugged import:
-
'Index' not found.
INFO 2013-03-10 15:10:17,674 dev_appserver.py:3104] "GET / HTTP/1.1" 500 -
Is VS debugger not breaking because as far as it is concerned this is not a user-unhandled exception? Any way so that VS debugger breaks before exception is handled by dev_appserver.py?
|