It is currently Mon Jul 22, 2024 10:16 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 99 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next
Author Message
 Post subject: Re: Test for duplicate scripts
PostPosted: Fri Nov 25, 2011 2:08 am  (#41) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
There isn't any fixed limit set, but you seem to have found a limitation. I'm not sure what I can do about that, other than questioning how sensible it is to have 817 scripts installed at the same time. ;)

I will think about it, and see if the methods it uses could be improved to cope and of course if anyone else wants to have a go at making improvements, feel free.

Kevin


p.s. I did discover yesterday that malformed scripts will cause this script to crash. I got an "Error reading string" error, which also showed up when doing a Refresh Scripts and I've just this second found that a script which give the error "Error: unmatched parentheses: 1" causes this script to hang in the way you describe. Hmm... I feel version 1.6 coming on, but please be patient and do the Refresh Scripts and deal with unmatched parentheses first.


Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Fri Nov 25, 2011 7:55 am  (#42) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
Make that 818, I noticed RobA's new script and thought "why not" I guess I'm a collector of sorts.

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Sat Nov 26, 2011 2:06 pm  (#43) 
Offline
GimpChat Member
User avatar

Joined: Apr 08, 2010
Posts: 5420
Location: Northwest Ohio
OK, I typed the line into the proper place in the script-fu console, but nothing happened. Do I need to click something?Image


Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Sat Nov 26, 2011 5:35 pm  (#44) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
Not click, but press the Return/Enter key to enter what you have typed.


Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Sat Nov 26, 2011 10:16 pm  (#45) 
Offline
GimpChat Member
User avatar

Joined: Apr 08, 2010
Posts: 5420
Location: Northwest Ohio
Ok, here ya' go....finally.

Image


Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Sat Nov 26, 2011 11:06 pm  (#46) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
2-ton wrote:
Ok, here ya' go....finally.

Image

It looks like you've maybe typed in 'gimp-pimprc-query' -- can you perhaps provide a more zoomed-in screenshot?

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Sun Nov 27, 2011 8:25 am  (#47) 
Offline
GimpChat Member
User avatar

Joined: Apr 08, 2010
Posts: 5420
Location: Northwest Ohio
This time I copied and pasted so I wouldn't make an error!
This is cool, I wish there was a local place that I could take classes on script writing for both python and script-fu....and on advanced uses of Gimp, lol.
Image


Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Sun Nov 27, 2011 10:22 am  (#48) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
2-ton wrote:
This time I copied and pasted so I wouldn't make an error!
This is cool, I wish there was a local place that I could take classes on script writing for both python and script-fu....and on advanced uses of Gimp, lol.


Thanks for that. You've successfully shown that MACs are doing things the same way as Linux, at least as far as path separators are concerned.

As far as learning script writing using script-fu/python, as I said to MrBigzz: viewtopic.php?f=9&t=3174&start=0#p40305 have a look at the tutorials, make a start, and start a thread to ask questions in. Remembering of course that there's no such thing as a stupid question.

Kevin


Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Sun Nov 27, 2011 1:32 pm  (#49) 
Offline
GimpChat Member
User avatar

Joined: Apr 08, 2010
Posts: 5420
Location: Northwest Ohio
I have tried to learn html and css on my own, and have not done very well, lol. Hopefully one day I will have time to really get into it.


Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Mon Nov 28, 2011 9:42 am  (#50) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there

Here we go again... Version 1.6 this time

The changes to this version were mainly to help Graechan diagnose the problem seen earlier: viewtopic.php?f=9&t=3057&start=30#p40101 somewhere in the 108 script-files removed.

The newest User Interface:
Image
Where there is now a new logging level: "Too Much". This tries to log information as it processes the files, so examining the log should show which file is causing the problem.

There is also now an option to control where the "normal" messages go. I have also changed it so that the normal messages are grouped together and only displayed at the end in one go, which will get rid of the "Too many messages" warning.

Normal message:
Image

Normal with few duplicates:
Image

There is downside to this approach when there are many duplicates:
Image

If I'm right about what is causing script-fu to hang-up, a faulty script file with unmatched parentheses , then there doesn't seem to be anything I can do to prevent the hang-up - it hangs at the (read stream) command, and GIMP has to be re-started to get script-fu working again.

Kevin


Attachments:
File comment: Version 1.6
kp24_test_for_duplicate_scripts_1_6.zip [6.17 KiB]
Downloaded 126 times
Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Wed Nov 30, 2011 2:50 am  (#51) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
Still freezes at same location.1.7? maybe. I can't spot cause yet except to many scripts

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Wed Nov 30, 2011 4:03 am  (#52) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
Graechan wrote:
Still freezes at same location.1.7? maybe. I can't spot cause yet except to many scripts


Yes, it will still hang. Quoting from my last post:
paynekj wrote:
If I'm right about what is causing script-fu to hang-up, a faulty script file with unmatched parentheses , then there doesn't seem to be anything I can do to prevent the hang-up - it hangs at the (read stream) command, and GIMP has to be re-started to get script-fu working again.


The whole point of version 1.6 was to add extra logging so you could see which script file causes it to hang and either fix or remove the faulty file.

Kevin


Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Wed Nov 30, 2011 5:16 am  (#53) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
paynekj wrote:
If I'm right about what is causing script-fu to hang-up, a faulty script file with unmatched parentheses , then there doesn't seem to be anything I can do to prevent the hang-up - it hangs at the (read stream) command, and GIMP has to be re-started to get script-fu working again.

Try something like the following for reading a code file:
(let loop ((object (catch 'eof (read port))))
  (cond
    ((eof-object? object)
      (close-input-port port) ) ; exit loop
    ((eq? object 'eof)
      (generate-an-error-message "Unexpected parenthesis") ) ; error was caught, exit (file auto-closed? I can't recall)
    ((pair? object)
      (cond
        ((eq? (car object) 'script-fu-register)
          <handle PDB registration expression>
          (loop (catch 'eof (read port))) )
        ((eq? (car object) 'script-fu-menu-register)
          <handle menu registration expression>
          (loop (catch 'eof (read port))) )
        (else ; some other expression, not a registration
          (loop (catch 'eof (read port))) ))
    (else ; not a pair
        (loop (catch 'eof (read port))) )))


A couple of notes:
  • The ELSE clause of CONDs should not be wrapped in parentheses (your usage in the code I saw was not a problem because the SF-OPTION would never generate anything but handled cases).
  • It is not necessary to convert symbols to strings in order to compare them.
  • I am writing this on a netbook and have not tested the above code (caveat emptor!) but I believe that an extra right parenthesis results in system fault (which the above code CATCHes); and that a missing closing parenthesis will result in the expression being read getting discarded and an #<EOF> being returned. The above code does not report this latter case as an error but merely treats it as a normal end-of-file being reached; however, the last expression in the file (which is corrupted) will not be processed.

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Wed Nov 30, 2011 8:12 am  (#54) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
saulgoode wrote:
A couple of notes:
but I believe that an extra right parenthesis results in system fault (which the above code CATCHes);

Yes, this works - my script errors, but with the catch it behaves as expected.

saulgoode wrote:
and that a missing closing parenthesis will result in the expression being read getting discarded and an #<EOF> being returned.

This is not what happens (At least on the Windows XP systems I've tried it on)
(let loop ((object (catch 'eof (read port))))

The (read port) command never returns. If you want to pursue this, try reading from a file containing only this:
(define (something thing)
  (let* ( (somethingElse thing))
    somethingElse
;  )
)

I realise it would be possible to read the files one character at a time, but quite frankly I think the law of diminishing returns has kicked in at this point. I don't feel inclined to put a lot of effort into finding a solution to this one exception. But if you, or anyone else for that matter, would like to take up the cause, please do.

Kevin


Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Wed Nov 30, 2011 9:13 am  (#55) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
paynekj wrote:
saulgoode wrote:
and that a missing closing parenthesis will result in the expression being read getting discarded and an #<EOF> being returned.

This is not what happens (At least on the Windows XP systems I've tried it on)
(let loop ((object (catch 'eof (read port))))

The (read port) command never returns. If you want to pursue this, try reading from a file containing only this:

I am unable to try it in Script-fu at present, but running TinyScheme on GNU/Linux things appear to behave as I described. I am more inclined to think that the problem lies with Script-fu and not with Windows (Script-fu has some C-style hacks in its I/O which aren't in the original TinyScheme, or maybe it's that Script-fu's TinyScheme is a little outdated).
TinyScheme 1.39
ts> (define obj)
ts> (define port (open-input-file "payne.scm"))
ts> (set! obj (read port))
#<EOF>
ts> (eof-object? obj)
#t
ts> (close-input-port port)
ts> (define port (open-input-file "payne.scm"))
port
ts> (set! obj (catch 'eof (read port)))
#<EOF>
ts> (eof-object? obj)
#t
ts> (close-input-port port)
#t
ts>


paynekj wrote:
I realise it would be possible to read the files one character at a time, but quite frankly I think the law of diminishing returns has kicked in at this point. I don't feel inclined to put a lot of effort into finding a solution to this one exception. But if you, or anyone else for that matter, would like to take up the cause, please do.

I pretty much agree that using read-char is not worth the effort. Also, I am currently not very trusting of Script-fu's read-char; I've encountered problems with garbage values being returned when trying to read lots of files in sequence (trying to create previews of a directory of gradients).

I hope to look into it in the future but it is not a high priority.

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Wed Nov 30, 2011 10:43 pm  (#56) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
Thankyou everyone I thought I would post the 2 offending scripts for you to look at. On one of them I can't see whats wrong,on the other I can't see whats right, everything is now OK

Attachment:
park faulty scripts.zip [4.66 KiB]
Downloaded 104 times

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Last edited by Graechan on Wed Nov 30, 2011 11:47 pm, edited 1 time in total.

Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Wed Nov 30, 2011 10:58 pm  (#57) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4050
Save layers as a palette works for me, just not sure what I am expecting to happen, is actually happening.

Tempest.scm isn't showing as scheme on my machine. It appears to be a different format.

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Wed Nov 30, 2011 11:58 pm  (#58) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
Thats right with-save_all_layers_with_palette_1.scm It functions allright but freezes the Test for duplicates script, and with Tempest.scm it does nothing in gimp and it also froze the Test for duplicates script.

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Thu Dec 01, 2011 12:44 am  (#59) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
tempest.scm is actually in rtf format. I loaded it up into wordpad and saved it out as a txt file then renamed it to a scm.

Attached (in a zip) for your convenience...

-Rob A>


Attachments:
Tempest.zip [2.16 KiB]
Downloaded 95 times

_________________
Image
Fantasy Cartography and Mapping by RobA
Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Thu Dec 01, 2011 12:47 am  (#60) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4050
Ahhhh, and Ubuntu didn't even give me a clue. Thanks, Rob. :D

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
Post new topic Reply to topic  [ 99 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Juxtapose exactly duplicate paths

2

No new posts Attachment(s) GEGL Jelly - Apply on Duplicate Layer above and use eraser

3

No new posts Attachment(s) pm_create_a_depthmap_image.py (Test)

8

No new posts Jewelry Text Test

8



* Login  



Powered by phpBB3 © phpBB Group