Actually, what I'd like to be able to do is not physically create a
file. I'd like to just hold that buf as a file object in memory on
which the read/write api's can get applied. In other words, I don't
want a somefile.jpg on my filesystem. I want to pass that buffer as a
file object on to some other layer in my code that will take care of
making that a file, similar to what I do with the
'file' attribute in the FieldStorage object.
Thanks,
SAm.
On Aug 16, 8:40 pm, Jose Galvez <[EMAIL PROTECTED]> wrote:
> have you tried
> buf = urllib.urlopener(....).read()
> f = file('/somefile.jpg', 'wb')
> f.write(buf)
> f.close()
>
> Jose
>
> SamDonaldson wrote:
> > Guys, I have one short question and this relates to the FieldStorage
> > Pylons file object in the way it represents a posted image. Does
> > anybody know what the 'file' attribute's type is in the object on
> > which read/write/close is invoked? I'm trying to do the following:
>
> > I'm reading in binary data from somewhere into memory, and I want to
> > now convert that into an image file. What are the steps to do that:
>
> > buf = urllib.urlopner(....).read()
> > f = open(buf, 'wb')
> > But this has created a file descriptor...What's happening is that
> > after I call read() on f, I'm getting a bad file descriptor error.
> > How do I fix this problem?
>
> > Thanks,
>
> > Sam
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---