Base64 Encode/ Sys.stdin error.

rickr at brickroad.net rickr at brickroad.net
Fri Sep 22 18:45:32 EDT 2000


i'm using the mailfiles.py program by Stuart Rackham
and I'm having trouble at this point:

infile = sys.stdin
outfile = part.startbody(type, [("name", os.path.basename
(infile.name))])

base64.encode(infile, outfile)

def encode(input, output):
	while 1:
		s = input.read(MAXBINSIZE)

I get this error from the base64.py
   File "C:\Program Files\Python\Lib\base64.py", line 18, in encode
   s = input.read(MAXBINSIZE)
   user_exception exceptions.IOError (9, 'Bad file descriptor')
   <traceback object at 17a1d88>

now I know what the problem is.. but I don't know how to work around it.
i'm not sure why he used sys.stdin
but I've not found a way to replace it.

Rick


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list