Switch to full style
Ask all general Gimp related questions here
Post a reply

GIMP 2.10 doesn't install my python plug-ins

Sat Jul 18, 2020 9:41 am

GIMP Version: 2.10
Operating System: Windows
GIMP Experience: New User

List any ERROR messages you received:
Querying plug-in: 'C:\Users\Alex\AppData\Roaming\GIMP\2.10\plug-ins\Logo_Positioning.py'
Traceback (most recent call last):
File "C:\Users\Alex\AppData\Roaming\GIMP\2.10\plug-ins\Logo_Positioning.py", line 7, in <module>
from gimpfu import *
File "c:\program files\gimp 2\32\lib\gimp\2.0\python\gimpfu.py", line 224
raise error, "procedure name contains illegal characters"




Hi,
I wrote a small python plug-in but I have trouble installing it into GIMP. When I paste it into the console it works perfectly but after starting GIMP via CMD-console I get the following error message:

Querying plug-in: 'C:\Users\Alex\AppData\Roaming\GIMP\2.10\plug-ins\Logo_Positioning.py'
Traceback (most recent call last):
File "C:\Users\Alex\AppData\Roaming\GIMP\2.10\plug-ins\Logo_Positioning.py", line 7, in <module>
from gimpfu import *
File "c:\program files\gimp 2\32\lib\gimp\2.0\python\gimpfu.py", line 224
raise error, "procedure name contains illegal characters"

I don't have any clue what the issue could be. As I said, running the script via python-console in GIMP is no problem.

Line 7 in my script:
Code:
from gimpfu import *

My code:
Code:
#debug:
#"c:\program files\gimp 2\bin\gimp-2.10" --verbose --console-messages


import math
import csv
from gimpfu import *

def dataModeling(pos):
    data_x=[]
    data_y=[]
    for i,row_i in enumerate(pos):
        data_x.append(row_i[1])
        data_y.append(row_i[2])
    return data_x, data_y

def openLogo(path_logo):
    image_logo = pdb.file_png_load(path_logo, path_logo)
    display = pdb.gimp_display_new(image_logo)
    pdb.gimp_edit_copy(image_logo)
    return

def layerCreation(data_x, data_y):
    for i, x_el in enumerate(data_x):
        y_el=data_y[i]
        layer = pdb.gimp_layer_new(image, width_logo, height_logo, RGB_IMAGE, "Logo", 100, OVERLAY_MODE)
        layer_position = i
        x_pos=int(float(x_el))-width_logo/2
        y_pos=int(float(y_el))-height_logo/2
        pdb.gimp_image_insert_layer(image, layer, None, layer_position)
        pdb.gimp_layer_translate(layer, x_pos, y_pos)
        floating_sel = pdb.gimp_edit_paste(layer, TRUE)
        pdb.gimp_floating_sel_anchor(floating_sel)
    return

def LogoPos():
    path_pos = "PATH TO CSV"
    path_img = "PATH TO BACKGROUNDIMG"
    path_logo = "PATH TO LOGO"
    width_logo = 213
    file = open(path_pos)
    pos = csv.reader(file, delimiter=",")
    data_x, data_y = dataModeling(pos)
    del data_x[0]
    del data_y[0]
    openLogo(path_logo)
    image = pdb.file_jpeg_load(path_img, path_img)
    display = pdb.gimp_display_new(image)
    layerCreation(data_x, data_y)
    print("Done.")
    return

register(
    "python-fu-logo-pos",
    "Logo positioning",
    "Position of Logos on predefined coordinates",
    "Alexander Böttjer", "Alexander Böttjer", "2020",
    "add logos",
    "*", # type of image it works on (*, RGB, RGB*, RGBA, GRAY etc...)
    [],[],
    LogoPos, menu="<Image>/File")  # second item is menu location

main()


Thanks

Re: GIMP 2.10 doesn't install my python plug-ins

Sat Jul 18, 2020 10:56 am

As you've got non ASCII characters in there, have a look at this viewtopic.php?f=9&t=15232&p=211140&hilit=encoding#p211140
Post a reply