Boris K�ster <[EMAIL PROTECTED]> wrote:
> 
> I need to write a wrapper for qmail-queue and I have some
> "understanding problems".
[...] 

> f = os.fdopen(0, "rb")
> fd0 = f.readlines()
> 
> f = os.fdopen(1,"rb")
> fd1 = f.readlines( 

Typo, I assume?    ^^^

readlines() isn't really what you want here, anyway -- the envelope, in
particular, won't contain linefeeds.  It's ASCII NUL terminated strings
in series.

> koz=''
> for key in fd0:
>     koz=koz + key + "\n"

What are you trying to do here?  Add additional linefeeds to each line
in the message?   That will mess the header up nicely -- only the first
line will remain in the header; the rest of it will be considered part
of the body due to the extra linefeed after the first line.

> koz ="/var/qmail/bin/qmail-queue.orig "+koz

... then you prepend the path to qmail-queue to the message contents...
 
> infd, outfd = popen2.popen2(koz)

Then you try to open the whole mess of a string as a command.  It
doesn't exist.  I think you mean to open the command and then feed it
the message on stdin, but this is not the way to do it.

> for key in fd1:
>     outfd.write(key+"\n")

This will write the entire envelope out, plus an extra linefeed.  As I
said, readlines() will treat the whole envelope as one 'line' with no
trailing linefeed.

What are you trying to do?

Charles
-- 
-----------------------------------------------------------------------
Charles Cazabon                            <[EMAIL PROTECTED]>
GPL'ed software available at:  http://www.qcc.sk.ca/~charlesc/software/
-----------------------------------------------------------------------

Reply via email to