help: loading binary image data into memory

Robert Kern rkern at ucsd.edu
Mon Apr 11 21:37:49 EDT 2005


Jeff Epler wrote:
> probably something like this: (untested)
>     def make_ftplib_callback(f):
>         def callback(block): f.write(block)
>         return callback
>     img = cStringIO.StringIO()
>     retrbinary( "get ???", make_ftplib_callback(img))

Ummm, how about

img = cStringIO.StringIO()
retrbinary("get ???", img.write)

?

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter




More information about the Python-list mailing list