Skip to main content
Participant
Nov 11, 2024 5:05 PM UTC
Question

Python debugger anyone ?

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
Feb 14, 2025 9:07 AM UTC

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>)

 

Translate