Switch to full style
Post all Gimp scripts and script writing questions here
Post a reply

Error: ( : 1) atom->string: needs 1 argument(s) [solved]

Wed May 09, 2018 4:13 am

I'm trying to make a calendar script work in GIMP 2.10
Have already replaced occurence of NORMAL-MODE with LAYER-MODE_NORMAL-LEGACY
and BACKGROUND-FILL with FILL-BACKGROUND

Now when I run Filters/Render/Calendar... it gives me following error:
Error: ( : 1) atom->string: needs 1 argument(s)

I have no idea what it wants to tell me by that ... what to change where.
Is there anyone around who can help?

I attach the original script [sg-calendar.scm] ( working in GIMP 2.8.x) and my trial to make it work in 2.10
as far as I have it now [sg-calendar210.scm].

Any help very appreciated
nelo

Re: Error: ( : 1) atom->string: needs 1 argument(s)

Wed May 09, 2018 4:41 am

Tried both versions.

I don't get that error, but a different one:

Error: Procedure execution of gimp-image-lower-layer failed: Layer cannot be lowered more.

This only when trying to create a full year.
When trying to create one single month, it runs.

Re: Error: ( : 1) atom->string: needs 1 argument(s)

Wed May 09, 2018 5:59 am

This is the same error I get when running 'Wills Animation Merge' script in Gimp 2.10. The script works in Gimp 2.88.
Maybe there are other scripts throwing this error message?
I would be very interested in a solution.
Obviously Gimp 2.10 is processing scheme differently :seeya

Re: Error: ( : 1) atom->string: needs 1 argument(s)

Wed May 09, 2018 12:28 pm

It seems to work on a Windows 7 32 bit version but it produces above mentioned error on my Linux 64 bit system. If only I knew how to find the position in the script that causes this.

Re: Error: ( : 1) atom->string: needs 1 argument(s)

Wed May 09, 2018 3:12 pm

nelo wrote:It seems to work on a Windows 7 32 bit version but it produces above mentioned error on my Linux 64 bit system. If only I knew how to find the position in the script that causes this.


Sprinkle the code with calls to gimp-message and see which one prints last, then by dichotomy you'll quickly find out.

Re: Error: ( : 1) atom->string: needs 1 argument(s)

Wed May 09, 2018 4:04 pm

These scripts wouldn't work for me using gimp 2.8.22 on windows 10 64bit until I replaced the text shown below with numbers

I replaced
LAYER-MODE-NORMAL-LEGACY with the number 0
FILL-BACKGROUND with the number 1
FILL-TRANSPARENT with the number 3

edit there are two FILL-BACKGROUND to replace

Re: Error: ( : 1) atom->string: needs 1 argument(s)

Thu May 10, 2018 12:32 pm

Hello Steve,
thanks for your reply.
Tried that version, too. But didn't make a difference

Hello Ofnuts,
Thanks for pointing me to the gim-message stuff which I didn#t know before. I'm sure it'll help me locate errors.

Re: Error: ( : 1) atom->string: needs 1 argument(s)

Sat May 12, 2018 4:46 am

nelo wrote:It seems to work on a Windows 7 32 bit version but it produces above mentioned error on my Linux 64 bit system. If only I knew how to find the position in the script that causes this.

If you write it in Python, and you start Gimp from the Terminal, you get row numbers where the error occurs via stderr (probably); at least in the Gimp version I use (2.6-ish). That doesn't happen with the Scheme interpreter?
(Personally, I refuse to have anything to do with Scheme code, so I wouldn't know.)
Example (I temporarily destroyed my working code):
Code:
qruqs@maytay ~/Downloads $ gimp
  File "/home/qruqs/.gimp-2.6/plug-ins/qjpgArtifacts.py", line 59
    pdb.gimp_selection_layer_alpha(grid lyr)
                                          ^
SyntaxError: invalid syntax

Re: Error: ( : 1) atom->string: needs 1 argument(s)

Sun May 13, 2018 4:18 am

Thanks for your reply.
No the Scheme interpreter doesn't do this. There is a message window in GIMP if errors occur.
Normally if you have for example NORMAL-MODE instead of LAYER-MODE-NORMAL-LEGACY (which is to be used in GIMP 2.10) it tells you about NORMAL-MODE ... so I can check the code, search which procedure goes with it, check the procedure-browser how to do it and so on. But with mentioned error message ? There's no "atom", no "string" in the code and I don't know enough SCHEME to see the error.
I might have found the place where things go wrong ( using gimp-message to narrow it down). Now I have to learn why and how to correct.

Re: Error: ( : 1) atom->string: needs 1 argument(s)

Sun May 13, 2018 5:31 am

I encountered this error from within a python script a good while ago - I cannot really remember what on earth it was - but it was a pain to track down. And yes I used gimp_message to narrow down the possibilities. Best of luck.

Re: Error: ( : 1) atom->string: needs 1 argument(s)

Sun May 13, 2018 7:13 am

Qruqs wrote:
nelo wrote:It seems to work on a Windows 7 32 bit version but it produces above mentioned error on my Linux 64 bit system. If only I knew how to find the position in the script that causes this.

If you write it in Python, and you start Gimp from the Terminal, you get row numbers where the error occurs via stderr (probably); at least in the Gimp version I use (2.6-ish). That doesn't happen with the Scheme interpreter?
(Personally, I refuse to have anything to do with Scheme code, so I wouldn't know.)
Example (I temporarily destroyed my working code):
Code:
qruqs@maytay ~/Downloads $ gimp
  File "/home/qruqs/.gimp-2.6/plug-ins/qjpgArtifacts.py", line 59
    pdb.gimp_selection_layer_alpha(grid lyr)
                                          ^
SyntaxError: invalid syntax


When I find buggy scheme scripts I find it faster to rewrite them in Python :)

Re: Error: ( : 1) atom->string: needs 1 argument(s)

Sun May 13, 2018 7:16 am

nelo wrote:There's no "atom", no "string" in the code and I don't know enough SCHEME to see the error.


About everything is an atom in Scheme (except lists). Here the error would be some implicit conversion of an atom to a string, but since it's implicit it will be hard to find (especially since the atom isn't a string... :evilgrin )

Re: Error: ( : 1) atom->string: needs 1 argument(s)

Mon May 14, 2018 6:02 am

Here are 3 steps to troubleshoot old scripts in Gimp 2.10.

Open Gimp 2.10 Edit > Preferences > Debugging > change debug policy to 'debug warnings, critical errors and crashes > click OK.
Close Gimp.

open command prompt.
gimp --pdb-compat-mode=off --verbose
(Windows needs the full path to Gimp)

If your script works on layers then open a mutilayer test image(s) and change the little box in 'Layers -Patterns' to the right of 'mode'. Change to 'Legacy'.
Hopefully you will get more info on whats failing.
Image

Re: Error: ( : 1) atom->string: needs 1 argument(s)

Mon May 14, 2018 8:36 am

nelo wrote:There's no "atom", no "string" in the code and I don't know enough SCHEME to see the error.
I might have found the place where things go wrong ( using gimp-message to narrow it down). Now I have to learn why and how to correct.


I find 5 instances of the function number->string in your modified version of the code.

In the file GIMP 2.10\share\gimp\2.0\scripts\script-fu.init you will find the definition of number->string, which uses atom->string:
Code:
(define (number->string n . base)
    (atom->string n (if (null? base) 10 (car base))))


I am very puzzled how you can manage to get the error reported because I don't see a way for the script to have called atom->string without anything as an argument.

Re: Error: ( : 1) atom->string: needs 1 argument(s)

Mon May 14, 2018 9:14 am

@Tas_mania
Thanks fo the tip on debugging. I'll try that out.

@paynekj
I don't know what's missing there, what it's complaining about. Why it reports to me and not to others. Also I don't understand why the original code works on a windows 7 install of GIMP 2.10 and not on my Linux flatpak installation. Hopefully I'll find out. Otherwise I'll have to keep GIMP 2.8 just do make next year's calendar towards the end of the year.

Just to be sure I didn't break anything I'll start modifying from the beginning ... with all that debug stuff enabled. I'll see how far I get, what errors occur.

Re: Error: ( : 1) atom->string: needs 1 argument(s)

Mon May 14, 2018 11:21 am

Here's something else to try to check the building-blocks are in place.

Start the Script-fu console Filters>>Script-Fu>>Console

In the command line:
(tracing TRUE)
(number->string 5)

I get this, do you?
Code:
> (tracing TRUE)

Gives: 0
> (number->string 5)

Eval: (number->string 5)
Eval: number->string
Eval: 5
Apply to: (5)
Eval: (atom->string n (if (null? base) 10 (car base)))
Eval: atom->string
Eval: n
Eval: (if (null? base) 10 (car base))
Eval: (null? base)
Eval: null?
Eval: base
Apply to: (())
Eval: 10
Apply to: (5 10)
Gives: "5"

Re: Error: ( : 1) atom->string: needs 1 argument(s)

Mon May 14, 2018 12:24 pm

nelo wrote:No the Scheme interpreter doesn't do this.

Pity. Perhaps use diff?
I get this:
Code:
$ diff -ytiw --width=120 --suppress-common-lines sg-calendar.scm sg-calendar210.scm > sg.res.txt


                                             100 NORMAL-MO |                                               100 LAYER-MOD
      (gimp-drawable-fill frame-layer TRANSPARENT-FILL)    |        (gimp-drawable-fill frame-layer FILL-TRANSPARENT)
      (gimp-edit-fill frame-layer BACKGROUND-FILL)         |        (gimp-edit-fill frame-layer FILL-BACKGROUND)
      (gimp-edit-fill  frame-layer BACKGROUND-FILL)        |        (gimp-edit-fill  frame-layer FILL-BACKGROUND)
  SF-ADJUSTMENT "Year" '( 2018 1753 2050 1 10 0 1 )        |    SF-ADJUSTMENT "Year" '( 2019 1753 2050 1 10 0 1 )
  SF-ADJUSTMENT "Year" '( 2017 1753 2050 1 10 0 1 )        |    SF-ADJUSTMENT "Year" '( 2019 1753 2050 1 10 0 1 )

Unless diff hides a character, or it should be like it is typed, MO is not equal to MOD, correct?

Re: Error: ( : 1) atom->string: needs 1 argument(s)

Mon May 14, 2018 2:27 pm

So I guess this one is one of the culprits:
(date-str (number->string date))

comparing the script-fu.init files of both GIMP versions I find.
GIMP 2.8:
(define (number->string n) (anyatom->string n number?))
GIMP 2.10:
(define (number->string n . base)

so far so good.
How would I have to change that line? Please help ... :cry

and here is the output of script-fu TRACE:
Code:
Willkommen bei TinyScheme
Copyright (c) Dimitrios Souflis
Skript-Fu-Konsole - Interaktive Scheme-Entwicklung

> (tracing TRUE)

Gives: 0
> (number->string 5)

Eval: (number->string 5)
Eval: number->string
Eval: 5
Apply to: (5)
Eval: (atom->string n (if (null? base) 10 (car base)))
Eval: atom->string
Eval: n
Eval: (if (null? base) 10 (car base))
Eval: (null? base)
Eval: null?
Eval: base
Apply to: (())
Eval: 10
Apply to: (5 10)
Eval: (#<CLOSURE> "( : 1) atom->string: needs 1 argument(s)")
Eval: #<CLOSURE>
Eval: "( : 1) atom->string: needs 1 argument(s)"
Apply to: ("( : 1) atom->string: needs 1 argument(s)")
Eval: (if (more-handlers?) (apply (pop-handler)) (apply error x))
Eval: (more-handlers?)
Eval: more-handlers?
Apply to: ()
Eval: (pair? *handlers*)
Eval: pair?
Eval: *handlers*
Apply to: (())
Eval: (apply error x)
Eval: apply
Eval: error
Eval: x
Apply to: (#<error PROCEDURE 134> ("( : 1) atom->string: needs 1 argument(s)"))
Apply to: ("( : 1) atom->string: needs 1 argument(s)")Error: ( : 1) atom->string: needs 1 argument(s)

Re: Error: ( : 1) atom->string: needs 1 argument(s)

Mon May 14, 2018 4:13 pm

Something else to try in the script-fu console
Code:
> (atom->string 5)
"5"
> (atom->string 5 2)
"101"

If it doesn't work with the 2nd test, then it looks like your version of GIMP has been built differently and it's time to start questioning the developers.

Full disclaimer. I'm trying this with GIMP-2.10-RC1 as I haven't been brave enough to install full 2.10 yet (too much trouble to keep the older versions intact)

It would be helpful if others could try the same test, stating which GIMP version and operating system.

Re: Error: ( : 1) atom->string: needs 1 argument(s)

Mon May 14, 2018 5:23 pm

paynekj wrote:Something else to try in the script-fu console
Code:
> (atom->string 5)
"5"
> (atom->string 5 2)
"101"

If it doesn't work with the 2nd test, then it looks like your version of GIMP has been built differently and it's time to start questioning the developers.

Full disclaimer. I'm trying this with GIMP-2.10-RC1 as I haven't been brave enough to install full 2.10 yet (too much trouble to keep the older versions intact)

It would be helpful if others could try the same test, stating which GIMP version and operating system.


Same as yours in my 2.10 flatpak on 'buntu 16.04.
Post a reply