开发者

Pylons interactive debugger UnboundExecutionError

Where I work, we use Pylons for our web development framework. Every so often when debugging an error using Pylons' interactive debugger, I encouter a traceback that includes the following type of error regarding a variable, etc. not being bound to a session:

UnboundExecutionError: Instance is not bound to a Session; attribute refresh opera开发者_运维问答tion cannot proceed

When this error is present, I am never able to output what a variable, etc affected by this error type is equal to at the interactive debugger prompt. However, I am able to log this information to the paster shell I have running in my terminal. Has anyone ever encountered something similar, or can tell why this error occurs?


It's an SQLAlchemy error. To avoid it, eagerly load all of the object attributes before an exception happens, and then you should be able to inspect that object.

AFAIU this error happens because BaseController destroys the session when an exception happens (there's a try:/finally: statement that calls meta.Session.remove()), so when you get to a debugger the session is already gone and objects associated with that session cannot access it any more.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜