Created
December 22, 2018 21:02
-
-
Save jtomori/f9c448ebce3ebc3bddca6bb288ee6983 to your computer and use it in GitHub Desktop.
Remote Python debugging, for https://jurajtomori.wordpress.com/2018/06/13/debugging-python-in-vfx-applications/
This file contains 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
import ptvsd | |
# allow other computers to attach to ptvsd at this IP address and port, using the password | |
try: | |
ptvsd.enable_attach("SFds_KjLDFJ:LK", address = ('localhost', 3000)) | |
print("Not attached already, attaching...") | |
except ptvsd.AttachAlreadyEnabledError: | |
print("Attached already, continuing...") | |
def test(): | |
# pause the program until a remote debugger is attached | |
ptvsd.wait_for_attach() | |
# break at this line | |
ptvsd.break_into_debugger() | |
before = "before" | |
after = "after" | |
print(before) | |
print(after) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment