IO Gurus: what are the differences between these two methods?

Lie Ryan lie.1296 at gmail.com
Tue Dec 8 13:07:59 EST 2009


On 12/8/2009 4:12 AM, dpapathanasiou wrote:
> I have two methods for writing binaries files: the first works with
> data received by a server corresponding to a file upload, and the
> second works with data sent as email attachments.
>
> The odd thing is, they're not interchangeable: if I use the first one
> to saved data parsed from an email attachment, it fails; similarly,
> the second function fails when dealing with an uploaded file data.
>
> What are the critical differences?

Those code reeks for refactoring. If you're lucky enough to be in python 
2.6 or above, use the io module to wrap the string in second function in 
a file-like object.



More information about the Python-list mailing list