This seems a question for comp.lang.python or [EMAIL PROTECTED] (does that still exist?).
Also, you might consider the APIs available in the tempfile module rather than os.tempfile(). On 8/7/07, Maciej Fijalkowski <[EMAIL PROTECTED]> wrote: > I've got slight problem with os.tmpfile(). What I would like to do is to get > the filedesc of tmpfile. > > First approach: > > os.tmpfile().fileno() of course does not work out, because fileno() does not > keep object alive. The solution is to keep os.tmpfile() result somewhere for > an arbitrary amount of time, which is quite obscure. This is problem with > all file operations, but fortunately if I want a filedesc, I can do just > os.open() which will not close the file for me. > > I've got several obscure solutions, noone satisfies me really: > > * If I use .fileno() than I'm on my own and I need to close file myself > > * .fileno() returns a int-like object which keeps alive file (well, this > will explode when keeping this as an index in a list, which does not keep > the object alive and so on) > > * have os._tmpfile() or whatever which returns filedesc > > What do you think? > > Cheers, > fijal > > > _______________________________________________ > Python-Dev mailing list > Python-Dev@python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/guido%40python.org > > -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com