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. Advertisements

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:
    768
    bruno at modulix
    Dec 1, 2005
  2. Lee Harr
    Replies:
    5
    Views:
    851
    Tim Peters
    Dec 30, 2005
  3. Jason Lunz

    monkeypatching NamedTemporaryFile

    Jason Lunz, May 26, 2006, in forum: Python
    Replies:
    2
    Views:
    392
    Jason Lunz
    May 27, 2006
  4. Imbaud Pierre

    tempfile.NamedTemporaryFile wont work

    Imbaud Pierre, Nov 19, 2006, in forum: Python
    Replies:
    6
    Views:
    541
    Imbaud Pierre
    Nov 19, 2006
  5. Edward Loper

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

    Edward Loper, Aug 9, 2007, in forum: Python
    Replies:
    0
    Views:
    629
    Edward Loper
    Aug 9, 2007
  6. Replies:
    2
    Views:
    675
    Lawrence D'Oliveiro
    Jul 17, 2008
  7. Roy Smith
    Replies:
    1
    Views:
    713
    Alice Bevan–McGregor
    Dec 31, 2010
  8. Jason Friedman
    Replies:
    0
    Views:
    223
    Jason Friedman
    Feb 21, 2013
Loading...