looking for command-pipe performance advice

jason-dated-14a0ce692bc19405 at mastaler.com jason-dated-14a0ce692bc19405 at mastaler.com
Fri Apr 6 12:36:42 EDT 2001


Sheila King <sheila at spamcop.net> writes:

> Couldn't you just do this?
> 
> headers = rfc822.Message(sys.stdin, 0)
> 
> # header examination #
> 
> inject_message = os.popen('/var/qmail/bin/qmail-inject', 'w')
> inject_message.write(headers+'\n')
> inject_message.write(sys.stdin.read())
> inject_message.close()

This returns a TypeError for me.

First:

    Traceback (most recent call last):
      File "./inject.py", line 10, in ?
        inject_message.write(headers+'\n')
    TypeError: __add__ nor __radd__ defined for these operands

Then after removing the '\n':

    Traceback (most recent call last):
      File "./inject.py", line 10, in ?
        inject_message.write(headers)
    TypeError: read-only character buffer, instance

This "read-only character buffer" error was why I was using StringIO
initially.




More information about the Python-list mailing list