#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    2
    Rep Power
    0

    Arrow Urgent Help required regarding separate process


    Hi All,
    Am in middle of python script, while executing a script i want to run two windows commands in separate terminal( means i have to create a separate process for each commands). currently i used os.system() and both of commands were running in same terminal.

    How to execute the command separately ??

    Thanks in Advance!

    Regards,
    Dhanavel
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,899
    Rep Power
    481
    Where you have
    os.system(command)
    use
    os.system('start '+command)

    If that fails try
    os.fork
    [code]Code tags[/code] are essential for python code and Makefiles!
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    2
    Rep Power
    0
    Thanks for your quick reply.

    if i use os.system('start'), it is opening a new terminal..but it if use os.system('start' + command) then it is not opening.

    my scenario is - i have to run these two commands in separate terminal os.system("echo %PATH% ") and os.system("dir").

    i can't use fork as am running in win platform.


    Regards,
    Dhanavel
  6. #4
  7. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,899
    Rep Power
    481
    Knowing the commands helps significantly.

    I assume you want to capture the output from these commands.

    import os
    files = os.listdir(os.curdir)
    path = os.environ['PATH']
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo