Skip to main content
Participant
November 11, 2024
Question

Python debugger anyone ?

  • November 11, 2024
  • 1 reply
  • 161 views

Hi guys.

Does anybody have a reliable recipe for attaching the Visual Code debugger to a Painter Python plugin? I've tried a couple of ways, but I've had no luck so far. 

1 reply

Participant
February 14, 2025

I have it working using debugpy and visual studio code, so should be possible to use VS to attach.

# debugpy errors out if you don't set os.__file__:
import os
import inspect
os.__file__ = inspect.getfile(lambda: None)
import debugpy

# The python exe must be the same python version that Painter uses:
debugpy.configure(python="path/to/standalone/python.exe")
debugpy.listen(<portnumber>)