Debug
Posted autoria
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Debug相关的知识,希望对你有一定的参考价值。
Traceback (most recent call last):
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.5.2\helpers\pydev\pydevd.py", line 2357, in
globals = debugger.run(setup[‘file‘], None, None, is_module)
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.5.2\helpers\pydev\pydevd.py", line 1777, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "C:/Users/Liu_100/PycharmProjects/flask/flaskr/manage.py", line 13, in
app = create_app(os.getenv(‘FLASK_CONFIG‘) or ‘default‘)
File "C:/Users/Liu_100/PycharmProjects/flask/flaskr\app_init__.py", line 43, in createapp
app.register_blueprint(api_1_0_blueprint, url_prefix=‘/api/v1.0‘)
File "C:\Users\Liu_100\AppData\Roaming\Python\Python27\site-packages\flask\app.py", line 65, in wrapper_func
return f(self, *args, **kwargs)
File "C:\Users\Liu_100\AppData\Roaming\Python\Python27\site-packages\flask\app.py", line 968, in register_blueprint
blueprint.register(self, options, first_registration)
File "C:\Users\Liu_100\AppData\Roaming\Python\Python27\site-packages\flask\blueprints.py", line 154, in register
deferred(state)
File "C:\Users\Liu_100\AppData\Roaming\Python\Python27\site-packages\flask\blueprints.py", line 129, in wrapper
func(state)
File "C:\Users\Liu_100\AppData\Roaming\Python\Python27\site-packages\flask\blueprints.py", line 400, in
self.name, code_or_exception, f))
File "C:\Users\Liu_100\AppData\Roaming\Python\Python27\site-packages\flask\app.py", line 65, in wrapper_func
return f(self, *args, **kwargs)
File "C:\Users\Liu_100\AppData\Roaming\Python\Python27\site-packages\flask\app.py", line 1201, in registererror_handler
exc_class, code = self.getexc_class_and_code(code_or_exception)
File "C:\Users\Liu_100\AppData\Roaming\Python\Python27\site-packages\flask\app.py", line 1125, in getexc_class_and_code
assert issubclass(exc_class, Exception)
TypeError: issubclass() arg 1 must be a class
问题出在createapp里app.register_blueprint
api = Blueprint(‘api‘, __name__)
from . import authentication, posts, users, comments, errors
在.errors里调用了一个exception.py里的ValidationError,错误声明为了def(应该是class)
api.errorhandler(ValidationError)
def validation_error(e):
return bad_request(e.args[0])
)
以上是关于Debug的主要内容,如果未能解决你的问题,请参考以下文章
调试,高级--step into my code ,只调试自己写的代码,shux,各种step操作debug
Xcode8:"subsystem: com.apple.UIKit, category: HIDEventFiltered, enable_level: 0" 的警告(代码片段