Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
VS code using python of GIMP
#1
Hi

This is not a real GIMP question but related to using the python used by GIMP.
I have windows 10, only GIMP is installed and I didn't install any python. Still I can use python in GIMP, so this means somewhere GIMP has python included?
Where is it?

I installed visual studio code and the python extension

https://code.visualstudio.com/

https://marketplace.visualstudio.com/ite...hon.python

But when i open a gimp plugin file, many errors.
Does anybody know how to make vs code detect he python used by GIMP so the errors are gone?

See error on screenshots

Many settings for the python extension for vs code, but what to change and how?


Attached Files Thumbnail(s)
           
Reply
#2
(03-03-2024, 06:26 PM)gimpygirl Wrote: Hi

This is not a real GIMP question but related to using the python used by GIMP.
I have windows 10, only GIMP is installed and I didn't install any python. Still I can use python in GIMP, so this means somewhere GIMP has python included?
Where is it?

I installed visual studio code and the python extension

https://code.visualstudio.com/

https://marketplace.visualstudio.com/ite...hon.python

But when i open a gimp plugin file, many errors.
Does anybody know how to make vs code detect he python used by GIMP so the errors are gone?

See error on screenshots

Many settings for the python extension for vs code, but what to change and how?

VS Code isn't able to locate/read GIMP modules, but you can hide the errors.

At the bottom of VS Code, select the 'Problems' tab. In the list of problems, right-click on a GIMP specific problem, and select: Add '# type ignore' ... option. The error should no longer appear.
   


Code:
# Import 'as fu' to avoid import complications.
import gimpfu as fu  # type: ignore
pdb = fu.pdb

# Another way is import only what you need.
from gimpfu import pdb  # type: ignore

VS Code no longer supports for Python 2.7, so I suggest setting the interpreter to Python 3.10. Unfortunately, the side-effect is that there will be some Python errors show up that are incorrect for Python 2.7.
Reply


Forum Jump: