🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.tcl
Article #57

Re: Python

#57
From: Ralf Fassel
Date: Thu, 15 Oct 2026 16:31
33 lines
2108 bytes
* saito <saitology9@gmail.com>
| It works quite well. Things to note:
>
| 1) Currently both input and output is line oriented.
>
| 2) If the result from python has multiple lines, you need to go
|    multiple gets to consume all.

I have similar inter-process-pipes, though between two TCL processes.

For line-oriented communication, I simply base64-encode the whole
content and send one line, base64-decode on the other side.
That way each message (regardless how long within sane limits :-)
is one line only.

Sender:
  package require base64
  proc send_base64 {chan txt} {
    set line [base64::encode -maxlen 0 [encoding convertto utf-8 $txt]]
    # assumes line-buffering
    puts $chan $line
  }

Receiver:
  package require base64
  proc recv_base64 {chan} {
      # error and eof handling omitted
      gets $chan line
      return [encoding convertfrom utf-8 [base64::decode $line]]
  }

HTH
R'
Technical Details
Message-ID: <ygajynjudqo.fsf@akutech.de>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <11anurd$1gcvi$2@dont-email.me> <11aq3bq$27p1e$1@dont-email.me> <11aqib8$2dede$1@dont-email.me>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Ralf Fassel <ralfixx@gmx.de>
Newsgroups: comp.lang.tcl
Subject: Re: Python
Date: Thu, 15 Oct 2026 18:31:43 +0200
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <ygajynjudqo.fsf@akutech.de>
References: <11anurd$1gcvi$2@dont-email.me> <11aq3bq$27p1e$1@dont-email.me>
	<11aqib8$2dede$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Thu, 15 Oct 2026 16:31:43 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="2702088"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18H1/LpbWspDtOwwOqCgP5z"; posting-host="d2a60e8afa018a0edd2c5e8290e22ce0"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:pLlq/mOL7dVzW5kiO4fxmcCTl/E=
	sha1:B+0QgoLmZ7RlOIrsBjmX60mKr3k= sha256:f0V1GMQt327WwMX8MO1Qhe1yQKQOTK3LgxTsbcDlGfA=
	sha1:NxXdRnpiyc2uM+jZ6NY9A4ilS6w= sha256:b98oZGssJEj2iJHhIJJUn3H4WHqrAd/fNnj5qn5GO1E=