It is currently Mon Jul 01, 2024 11:01 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: GIMP 2.10 doesn't install my python plug-ins
PostPosted: Sat Jul 18, 2020 9:41 am  (#1) 
Offline
New Member

Joined: Jul 18, 2020
Posts: 1
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:
from gimpfu import *

My 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


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: GIMP 2.10 doesn't install my python plug-ins
PostPosted: Sat Jul 18, 2020 10:56 am  (#2) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
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


Top
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) I was able to install Gimp with Python-Fu ( SOLVED )

2

No new posts Attachment(s) UPDATE - I was able to install Gimp with Python-Fu ( SOLVED )

0

No new posts use in python of plug-in lighting

4

No new posts Attachment(s) GIMP Python-Fu Plug-in template

4

No new posts Plug-in crashes after OS upgrade: python version mismatch? maybe?

4



* Login  



Powered by phpBB3 © phpBB Group