On 28 ago, 22:21, billiejoex <[EMAIL PROTECTED]> wrote:

> Another question: I have to open file for writing ('wb') but I noticed
> that both tempfile.mkstemp() and os.fdopen() accept a "mode" argument.
> It's not clear *when* do I have to specify such mode. When using
> tempfile.mkstemp?
>
> Moreover, what happens if I specify "text" mode when using mkstemp and
> "binary" mode when using fdopen?
>
> PS - I think that tempfile.mkstemp docstring should be enhanced to
> cover such and other questions (e.g. I find reasonable that every user
> using tempfile.mkstemp() should use also os.fdopen() in conjunction
> but this isn't mentioned).

As someone already suggested, why don't you use TemporaryFile or
NamedTemporaryFile and avoid such problems?

--
Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to