Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help! Unable to register Python script
#2
(10-24-2018, 04:47 PM)david Wrote: My first attempt at trying to modify an actual Python script.

I have taken the Uncrop script of Lloyd Konneker and modified it (using the Bluefish Editor) so that it "uncrops" on the left-hand side.
I was able to register this as uncrop-side1.py.

My next step was to add another slider so that I could specify the sample-width for the resynthesizer. However, all my attempts to register this as uncrop-side2.py have come to nothing!

I am obviously making a stupid mistake, but several days of searching has not helped. If someone could point out my obvious error it would be much appreciated.

I have substituted the appropriate parameters into uncrop-side1.py (without re-registering) to "uncrop" right, top and bottom, and that all worked. The intention was to add an additional PF_OPTION or PF_RADIO to select the side to uncrop and then re-register it under a suitable name. The end result will probably be of little value, but a useful education for me!

Attached are the two files - uncrop-side1 - (working) and uncrop-side2 - (not registering).

david.

Just start Gimp in a terminal... you'll see:

Code:
Traceback (most recent call last):
  File "/path/to/plugin-uncrop-side2.py", line 126, in <module>
    (PF_SLIDER, "sampleWidth", _("Sample Width"), 50, (10, 250, 1))
TypeError: 'tuple' object is not callable


This is because you are missing the comma at the end of the line before, so Python thinks you are doing:
Code:
(PF_SLIDER, "percentEnlargeParam", _("Percent enlargement"), 5, (1, 25, 1))(PF_SLIDER, "sampleWidth", _("Sample Width"), 50, (10, 250, 1))
In other words, calling  the tuple (PF_SLIDER, "percentEnlargeParam", _("Percent enlargement"), 5, (1, 25, 1)) with argments PF_SLIDER, "sampleWidth", _("Sample Width"), 50, (10, 250, 1).
Reply


Messages In This Thread
Help! Unable to register Python script - by david - 10-24-2018, 04:47 PM
RE: Help! Unable to register Python script - by Ofnuts - 10-24-2018, 08:06 PM

Forum Jump: