Incognito
Incognito

Reputation: 1953

is there a way of hooking into a currently running python script to see whats going on?

I have a python script that occasionally freezes and I'd like to find out why? Is there a way to hook into a python script and see what the variables are what line its on and/or what its doing?

Upvotes: 13

Views: 4724

Answers (1)

Basic
Basic

Reputation: 26766

Original Answer

Use a debugger as shown in the answers to How do I attach a remote debugger to a Python process?

Once attached, you can pause execution and examine variables, the current stack, etc...

Update

As pointed out in the comments, the linked debuggers apparently require the process to be launched in a particular manner. Visual Studio (With Python Tools installed) does support attaching to a running process.

Upvotes: 1

Related Questions