Harold Fellermann <[EMAIL PROTECTED]> wrote:
>  I need to create a temporary file and I need to retrieve the path
>  of that file.  os.tmpnam() would do the job quite well if it wasn't
>  for the RuntimeWarning "tmpnam is a potential security risk to your
>  program". I would like to switch to os.tmpfile() which is supposed
>  to be safer, but I do not know how to get the path information from
>  the file object returned by tmpfile(). any clues?

You can't. The file opened doesn't have a name

    tmpfile(...)
        tmpfile() -> file object
        
        Create a temporary file with no directory entries.

Have a look at the functions in the tempfile module, mkstemp() in
particular (the posix way), or NamedTemporaryFile()

  http://docs.python.org/lib/module-tempfile.html

-- 
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to