Skip to content

Functionality questions #2

Answered by cifkao
BFergerson asked this question in Q&A
Oct 3, 2021 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

Thanks for your questions!

Let me answer the second question first, which is actually about two things: using NoPdb without a context manager, and threads. Yes, you can use NoPdb without a context manager: you just need to call the start() method of a NoPdb object, e.g.:

import nopdb


def fun():
    x = 5
    y = x


if __name__ == '__main__':
    dbg = nopdb.get_nopdb()  # Get the default NoPdb object for this thread
    dbg.breakpoint(file="myscript.py", line=6).exec("print(\"x: \" + str(x))")  # nopdb.breakpoint() would also work here
    dbg.start()  # Start debugging

    fun()

    dbg.stop()

About threads: A debugger is normally attached to only one thread (the one that started it…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@BFergerson
Comment options

@cifkao
Comment options

Answer selected by BFergerson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1 on October 03, 2021 15:25.