Problem with subprocess.Popen()

Discussion in 'Python' started by The Cruisemaniac, Aug 1, 2007.

  1. Hi all,

    I'm trying to run a windows batch file from a python script using
    subprocess.popen().

    The issue that I'm facing is that, if i give the batch file as
    parameter to the popen function, the script runs, but if i provide a
    parameter, it is not working.

    Can someone help me with the command.

    The actual windows command to be executed is:

    test.bat -t ABC_DE_FG_HI_001 "C:\ABCDEFGHIJKLMNOP.TXT"

    What is the actual parameter required for subprocess.Popen(parameter
    chain) in this case??

    Kindly help me out...

    Regards and Thanks in advance...
    Ashwin Murali.
     
    The Cruisemaniac, Aug 1, 2007
    #1
    1. Advertising

  2. > I'm trying to run a windows batch file from a python script using
    > subprocess.popen().
    >
    > The issue that I'm facing is that, if i give the batch file as
    > parameter to the popen function, the script runs, but if i provide a
    > parameter, it is not working.
    >
    > The actual windows command to be executed is:
    >
    > test.bat -t ABC_DE_FG_HI_001 "C:\ABCDEFGHIJKLMNOP.TXT"


    do something like:
    subprocess.Popen(r'test.bat -t ABC_DE_FG_HI_001
    "C:\ABCDEFGHIJKLMNOP.TXT",shell=True)

    This is same as doing os.system()

    If even this results in any error (post back the error message) and try
    setting the executable argument explicit.

    subprocess.Popen(r'test.bat -t ABC_DE_001
    "C:\ABCD.TXT",executable="test.bat",shell=True)


    --
    O.R.Senthil Kumaran
    http://uthcode.sarovar.org
     
    O.R.Senthil Kumaran, Aug 1, 2007
    #2
    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. Michele Simionato

    subprocess.Popen

    Michele Simionato, Dec 12, 2004, in forum: Python
    Replies:
    5
    Views:
    17,666
  2. 7stud

    subprocess.Popen() problem

    7stud, Jun 26, 2007, in forum: Python
    Replies:
    3
    Views:
    309
    7stud
    Jun 26, 2007
  3. Tim Golden
    Replies:
    0
    Views:
    459
    Tim Golden
    Oct 7, 2007
  4. Mathieu Prevot
    Replies:
    3
    Views:
    561
    Mathieu Prevot
    Jul 7, 2008
  5. File.popen/IO.popen

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

Share This Page