1

I'm looking to build a script using Gimps build in Python extension.

I have run into a problem 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:

GIMP 2.8.22 Python Console
Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)]
>>> 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:

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. (Translation edit!: The indicated module was not found)
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.

Nodine
  • 11
  • 3
  • I'd try to edit `gimpfy.py` by adding a temporary line with `raise Exception(sys.path)`, to see what do paths look like form the Gimp side at invocation time. – 9000 Dec 20 '17 at 20:31
  • 2
    I think i figured it out. The way python-fu works is that it interacts with a gimp process, so it has to be executed not via python standalone but via gimp, which of course makes it severly harder to work with. – Nodine Dec 20 '17 at 21:16
  • @Nodine What makes it hard is Windows, that doesn't like windowed processes to also write to a console. Debugging Gimp python scripts under Linux is really easy. But see https://www.gimp-forum.net/Thread-Debugging-python-fu-scripts-in-Windows for some hints. – xenoid Dec 21 '17 at 00:02
  • You could try to use a better shell on the Windows platforms, for example the bash from MinGW. Served me well when I was still building GIMP for the Windows platforms using msys+mingw... – Michael Schumacher Dec 29 '17 at 11:32

0 Answers0