-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
set_trace not working inside django #7
Comments
Try to run Django in single threaded mode. (i think it's with the |
The single threaded option is |
Found the same thing happening inside a Flask application File "/usr/lib/python2.7/bdb.py", line 49, in trace_dispatch
return self.dispatch_line(frame)
File "/usr/lib/python2.7/bdb.py", line 67, in dispatch_line
self.user_line(frame)
File "/usr/lib/python2.7/pdb.py", line 158, in user_line
self.interaction(frame, None)
File "/usr/lib/python2.7/pdb.py", line 210, in interaction
self.cmdloop()
File "/home/grok/.virtualenvs/foo/lib/python2.7/site-packages/ptpdb/__init__.py", line 160, in cmdloop
line = self._get_input()
File "/home/grok/.virtualenvs/foo/lib/python2.7/site-packages/ptpdb/__init__.py", line 223, in _get_input
return self.cli.cli.read_input().text
File "/home/grok/.virtualenvs/foo/lib/python2.7/site-packages/prompt_toolkit/interface.py", line 321, in read_input
self.eventloop.run(self.stdin, self.create_eventloop_callbacks())
File "/home/grok/.virtualenvs/foo/lib/python2.7/site-packages/prompt_toolkit/eventloop/posix.py", line 57, in run
with call_on_sigwinch(received_winch):
File "/home/grok/.virtualenvs/foo/lib/python2.7/site-packages/prompt_toolkit/eventloop/posix.py", line 155, in __enter__
self.previous_callback = signal.signal(signal.SIGWINCH, lambda *a: self.callback())
ValueError: signal only works in main thread |
found the same thing a year later. set_trace() causes a |
Hi @morenoh149, |
I know this is an old issue, but I can confirm this works in django |
@arshbot I have not tried this for a long time now, i will give it another shot and see if it is resolved or not. |
I believe I've run into the issue with The thing about
With line
One solution is to not create threads. There are 2 sources of threads in Django:
As such, the solution is The other solution is to not make it stop in the main thread before a non-main one. The quick and dirty way is: aaa = False
class ...:
def ...:
global aaa
aaa += 1
if aaa > 2: # the exact value depends
import pdb; pdb.set_trace() The third option is: Supposedly related bug. |
I got this stacktrace when i was testing ptpdb inside django with set_trace()
The text was updated successfully, but these errors were encountered: