Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
gimpfu not detected by pylance
#3
(10-24-2023, 07:39 AM)Ofnuts Wrote: Gimpfu only exists in the Gimp environment. It has a cascade of import dependencies (see /usr/lib/gimp/2.0/python/, and some of them are binaries (.so in Linux, likely .dll in windows) and these need an environment set up by Gimp to import correctly. Maybe you can copy the python files and remove a few imports to at least have an importable source for your IDE (never tried, I use a plain editor).

In any case this will only help with auto-completion, because the plugin has to run in a python module started by Gimp, so it won't run in your debug environment for instance.

This said, debugging under Linux is a lot easier than debugging under Windows because if you start Gimp from a command prompt, all messages from Gimp and the plugins appear in the command prompt.

Also see: Debugging python-fu scripts in Windows (which despite its title contains hints that are also useful on Linux/WSL)

Thanks for the reply, yes auto-completion, typing and linting are really the main things I'm looking for in development, rather than debugging. I just want to make stuff quickly and test it in Gimp.

One thing I tried was copy the files from C:\Program Files\GIMP 2\lib\gimp\2.0\python over to my plugins site. This helped with some autocompletion, but certain variables like PDB_INT8, PDB_INT16 etc, and various methods from pdb don't show up. I suspect this is because these files are compiled in pyd format, but I don't know how to decompile compiled python code, and I've read decompiling is a difficult task.

I'll see if plain Ubuntu will support this, or try other versions of Gimp, but these seem to carry their own issues in stackexchange.. Is there any place where I can view the python source code? I think it would be easiest if I just copy and paste the source code in my working directory, and let pylance figure it out.
Reply


Messages In This Thread
gimpfu not detected by pylance - by Sash4957 - 10-24-2023, 01:43 AM
RE: gimpfu not detected by pylance - by Ofnuts - 10-24-2023, 07:39 AM
RE: gimpfu not detected by pylance - by Sash4957 - 10-25-2023, 10:59 PM
RE: gimpfu not detected by pylance - by Ofnuts - 10-26-2023, 07:47 AM
RE: gimpfu not detected by pylance - by Sash4957 - 10-27-2023, 05:10 AM
RE: gimpfu not detected by pylance - by gimpygirl - 03-03-2024, 06:48 PM

Forum Jump: