newbie troubles: os.popen confusion

Discussion in 'Python' started by Jelle Feringa // EZCT / Paris, Nov 1, 2004.

  1. Hi,

    I'm learning python at the moment, and am trying to write some basic shell
    scripts to start off with.
    I having trouble executing programs from within python.
    Very basic operations such as:

    >>>listing = os.popen('dir /B').readlines()


    work out just fine, but when I do the same thing with a specific program, it
    doenst work out.

    >>>mr = os.popen(str(os.environ['MI_ROOT']) + 'ray3.exe').readlines()
    >>>mr

    []

    So I tried calling the program using win32pipe.
    The program gets launched, but when I try to connect to its output
    --o.readlines()-- the script is stuck until the process is killed.
    Also it seems to me that using win32pipe.popen2 options are specified in a
    different way than in os.popen where I can specify these directly.
    Could you put me in the right direction?

    Cheers,

    Jelle.

    >>>mr, o = win32pipe.popen2(str(os.environ['MI_ROOT']) + 'ray3.exe')


    ---actually "mr, o = win32pipe.popen2('ray3.exe')" does the same
    thing, its finding the program in the environment---

    >>>mr


    <open file 'C:\Softimage\XSI_4.0\Application\bin\nt-x86-p3\ray3.exe', mode
    'w' at 0x018735E0>

    >>>o.readlines()


    stops running the script until I kill the process
     
    Jelle Feringa // EZCT / Paris, Nov 1, 2004
    #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. Vig

    JNI troubles (newbie)

    Vig, Feb 11, 2005, in forum: Java
    Replies:
    6
    Views:
    759
  2. Anton Ishmurzin
    Replies:
    5
    Views:
    513
    Anton Ishmurzin
    Apr 7, 2004
  3. Steve Homer
    Replies:
    0
    Views:
    444
    Steve Homer
    Apr 29, 2004
  4. mm
    Replies:
    5
    Views:
    310
    Francesco Bochicchio
    Aug 24, 2009
  5. File.popen/IO.popen

    , May 20, 2006, in forum: Ruby
    Replies:
    1
    Views:
    272
    Robert Klemme
    May 20, 2006
Loading...

Share This Page