Home

On 28 ago, 22:21, billiejoex <gne...@gmail.com> 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

previous
next

Re: pure virtual method
Re: algebraic expression 'a*b+c' with CIN .Is it possible?
Re: reliable unit test logging
Re: Enum class with ToString functionality
Re: client server framework
Podnośniki
nauka jazdy trzebinia
Buty na zimę 2012
Mariquita
poker