Created
October 5, 2016 21:41
-
-
Save azinman/f201d97a1d4bf9e8496d66b0ee505cfe to your computer and use it in GitHub Desktop.
Enable PTVSD remote debugging despite gevent monkey patching
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Somewhere in our Django stack gevent was being invoked and monkey patching socket and threads. | |
# PTVSD uses low-level sockets + a thread to work, and the monkey patched version (even if you | |
# call gevent.monkey.patch_all()) somehow was not working correctly. | |
# By reloading those modules, you can get the debugger to work correct and step through your code. | |
import ptvsd, socket, thread, threading | |
reload(socket) | |
reload(thread) | |
reload(threading) | |
ptvsd.enable_attach("my_secret", address = ('0.0.0.0', 3000)) | |
ptvsd.wait_for_attach() | |
ptvsd.break_into_debugger() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment