NamedTemporaryFile and mode a+rwx

Discussion in 'Python' started by christophe.delarue@gmail.com, Oct 3, 2005.

  1. Guest

    Hi,

    I'd like to create a temporaty shell script. Therefore I use tempfile
    with NamedTemporaryFile. The problem is that the _mkstemp_inner create
    the file using 06000 code. Then the fdopen is called, but the stat of
    the file does not change to executable.

    Why the fdopen does not modify the mode of the file ?

    Without the executable flag, this could not be understood as an
    executable file.

    Thanks.

    the trace :

    >>> t=tempfile.NamedTemporaryFile(mode="a+rwx")
    >>> print t.name

    /tmp/tmp5wwa9K
    >>> print t.mode

    a+rwx
    >>> os.system("ls -l " + t.name)

    -rw------- 1 myLogin 0 Oct 3 15:30 /tmp/tmp5wwa9K
    >>> os.system("stat " + t.name)

    File: `/tmp/tmp5wwa9K'
    Size: 0 Blocks: 0 IO Block: 8192 regular empty
    file
    Device: 2h/2d Inode: 8593614 Links: 1
    Access: (0600/-rw-------) Uid: (10373/ numerix) Gid: ( 1102/
    rms)
    Access: 2005-10-03 15:30:38.000000000 +0200
    Modify: 2005-10-03 15:30:38.000000000 +0200
    Change: 2005-10-03 15:30:38.000000000 +0200
    , Oct 3, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John J Lee
    Replies:
    3
    Views:
    460
    bruno at modulix
    Dec 1, 2005
  2. Edward Loper
    Replies:
    0
    Views:
    449
    Edward Loper
    Aug 7, 2007
  3. John J Lee
    Replies:
    0
    Views:
    506
    John J Lee
    Aug 7, 2007
  4. Edward Loper

    mmm-mode, python-mode and doctest-mode?

    Edward Loper, Aug 9, 2007, in forum: Python
    Replies:
    0
    Views:
    418
    Edward Loper
    Aug 9, 2007
  5. Neal Becker
    Replies:
    0
    Views:
    371
    Neal Becker
    Aug 9, 2007
Loading...

Share This Page