Let's hope it gets applied. I'll make a bug report and attach the patch to it.
My code uses something like this to send the data:
def send(self, msg):
l = len(msg)
raw = 'G' + struct.pack('H%ds' % l, socket.htons(l), msg)
To receive the data, I use something like:
raw = self.socket.recv(4)
l = socket.ntohs(struct.unpack('H', raw[2:4]))
raw = self.socket.recv(int(l))
Worked ok until now. Very similar with your code :)
On Sun, May 24, 2009 at 9:41 PM, Niels Giesen <niels.gie...@gmail.com> wrote:
>> I have attached a small patch for script-fu-server that makes the
>> server return to the clients the output of the commands executed, just
>> like the script-fu-console does.
>> Is the patch ok? Any chance to apply it the mainline? Should I make a
>> bug-report and attach the patch to it?
> This is great stuff. If we had had this a year ago, it would have
> saved me a *lot* of ugly hacking about developing the client side
> gimp-mode for Emacs. (If you wanna know, this was done by
> wrapping the code to be sent
> inside scheme code that wrote back to a file, with stuff such as
> tracing and the various write and display functions not working).
> The other implementation I did to interact with GIMP was with GIMP as
> a subprocess as
> a batch program; this is quite crude and does not work under that other OS
> I have to use at work.
> Attached is a small python program (my first) I wrote this morning that gives
> a simple REPL interface to the script-fu server based on your
> patch, you might want to use that for testing if your patch works. So
> far it is going strong.
> I very much like to see this one implemented, and am working on
> rewriting parts of gimp-mode for Emacs to use this facility. Even
> though the script-fu server apparently was not intended for actual
> use, its usefulness at least for developing script-fu inside an editor
> of choice
> is greatly enhanced with these additions.
> It is looking promising.
Gimp-developer mailing list