question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

is it possible to check whether PTVS Python debugger is attached to process?

See original GitHub issue

The equivalent in C# is like this:

            while (!Debugger.IsAttached)
            {
                Thread.Sleep(100);
            }

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
zoobacommented, Jun 16, 2016

This isn’t guaranteed to keep working, but for currently released versions:

import sys
IS_DEBUGGING = '$visualstudio_py_debugger' in sys.modules
0reactions
denfromufacommented, Feb 27, 2017

@zooba I just tested and sys.gettrace() is working! This is very handy:

https://github.com/pythonnet/pythonnet/issues/332#issuecomment-282608123

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to check whether debugger of Python Tools for Visual ...
How to check whether debugger of Python Tools for Visual Studio 2010 is attached to current process? IsDebuggerPresent and ...
Read more >
Debug Python code - Visual Studio (Windows)
Visual Studio provides rich debugging for Python code, including setting breakpoints, stepping, inspecting values, looking at exceptions, ...
Read more >
Python Tools for Visual Studio
In Visual Studio, select Debug > Attach to Process to display the Attach to Process window, then: ... Once the debugger attaches, you...
Read more >
Debugging configurations for Python apps in ...
Selecting the Attach using Process ID one yields the following result: Added a configuration. See Debugging specific app types for details on all...
Read more >
Debug Your Python Excel Add-In
A guide to debugging Python code running in Excel with the most popular IDEs, including PyCharm, Eclipse, Visual Studio (PTVS) and VS Code....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found