Gimp-Forum.net
Problems running python-fu in external editor - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP)
+--- Forum: Extending the GIMP (https://www.gimp-forum.net/Forum-Extending-the-GIMP)
+---- Forum: Scripting questions (https://www.gimp-forum.net/Forum-Scripting-questions)
+---- Thread: Problems running python-fu in external editor (/Thread-Problems-running-python-fu-in-external-editor)



Problems running python-fu in external editor - Nodine - 12-20-2017

Hello! I'm looking to build a fairly advanced script using the Gimp Python extension.

I have run into some problems though, and these are my symptoms, perhaps someone here is able to help me.

When I run Python-fu from Gimp I get what you would expect, and a clear indication that everything is working.

System details:
Win10 - 64 bit

Gimp 2.8.22
Python.exe - version 2.7 (the one included in Gimp installation and seperate install to be sure)

Gimp message:
Code:
GIMP 2.8.22 Python Console
Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)]
➤> import sys
➤> sys.path
['C:\\Program Files\\GIMP 2\\lib\\gimp\\2.0\\plug-ins', 'C:\\Program Files\\GIMP 2\\32\\lib\\gimp\\2.0\\python', 'C:\\Program Files\\GIMP 2\\Python\\python27.zip', 'C:\\Program Files\\GIMP 2\\Python\\DLLs', 'C:\\Program Files\\GIMP 2\\Python\\lib', 'C:\\Program Files\\GIMP 2\\Python\\lib\\plat-win', 'C:\\Program Files\\GIMP 2\\Python\\lib\\lib-tk', 'C:\\Program Files\\GIMP 2\\Python', 'C:\\Program Files\\GIMP 2\\Python\\lib\\site-packages', 'C:\\Program Files\\GIMP 2\\Python\\lib\\site-packages\\gtk-2.0', 'C:\\Program Files\\GIMP 2\\Python\\lib\\site-packages']
➤> gimp
<module 'gimp' from 'C:\Program Files\GIMP 2\32\lib\gimp\2.0\python\gimp.pyd'>
➤>

However when I run a script with that entire path included, from the python.exe file I get:
Code:
C:\Python27\python.exe D:/P5/m-cworkshop/Sprites2d/spritofu.py
Traceback (most recent call last):
 File "D:/P5/m-cworkshop/Sprites2d/spritofu.py", line 2, in <module>
   from gimpfu import *
 File "C:\Program Files\GIMP 2\32\lib\gimp\2.0\python\gimpfu.py", line 76, in <module>
   import gimp
ImportError: DLL load failed: Det angivne modul blev ikke fundet.

Process finished with exit code 1

So its clearly able to pick up the gimpfu.py file, but not the gimp.pyd file right next to it.

Here is what i have been able to verify so far:
My python installations are 32 bit.
This happens on both my computers.
This happens no matter how many things I include in the path, as long as I include the gimpfu.py path.

I hope you can help me.
Regards - Nodine


RE: Problems running python-fu in external editor - Ofnuts - 12-20-2017

AFAIK the Gimp python scripts rely on communications with the Gimp process that only exist when they are started from Gimp, so assuming you can have everything loaded this most likely won't work anyway. Are you trying to make a python script (some code that is activated from the Gimp UI) ot some external procedure that uses Gimp?


RE: Problems running python-fu in external editor - wc.smith - 11-03-2021

speaking of gimp.pyd, where is a copy of gimp.py  I can't seem to find it anywhere...

Thanks,