使用python调试器,有没有办法在调用pdb.runcall()
之前创建一组断点?
我查看了文档并没有看到任何方法来创建其他断点或直接向实例提供.pdbrc配置。
我有这个:
def debug_jobs_from_lists(username, json_string, skip=None):
import pdb
import rlcompleter
from django.core.urlresolvers import reverse
from django.test.client import RequestFactory
from django.contrib.auth.models import User
from batsapi.multi import multi
if skip is None:
skip = []
rf = RequestFactory()
request = rf.post(
reverse('jobs-api'),
data=json_string,
content_type='application/json')
request.user = User.objects.get(username=username)
pdb_instance = pdb.Pdb(skip=['django.*'] + skip)
pdb_instance.complete = rlcompleter.Completer(locals()).complete
# Add breakpoint here to break in an underlying function
pdb_instance.runcall(multi, request)
答案 0 :(得分:0)
你可以试试:
pdb.set_trace()