suppress opening command window after using os.system command

Discussion in 'Python' started by boriq, Jun 12, 2008.

  1. boriq

    boriq Guest

    Hi,

    I'm using in my script command os.system('command') on Windows XP.
    Each time the os.system command is used, python opens an empty ms-dos
    command window (the black one) and then closes it. So when in one
    script the os.system command 50 times is used, I see 50 black windows.

    Is there a way of how to suppress this unnecessary command windows to
    be opened?

    thx.
    Boris
    boriq, Jun 12, 2008
    #1
    1. Advertising

  2. En Thu, 12 Jun 2008 05:28:13 -0300, boriq <>
    escribió:

    > I'm using in my script command os.system('command') on Windows XP.
    > Each time the os.system command is used, python opens an empty ms-dos
    > command window (the black one) and then closes it. So when in one
    > script the os.system command 50 times is used, I see 50 black windows.
    >
    > Is there a way of how to suppress this unnecessary command windows to
    > be opened?


    Use the subprocess module instead of os.system

    --
    Gabriel Genellina
    Gabriel Genellina, Jun 12, 2008
    #2
    1. Advertising

  3. boriq

    boriq Guest

    On 12 Jun., 11:51, "Gabriel Genellina" <> wrote:
    > En Thu, 12 Jun 2008 05:28:13 -0300, boriq <>  
    > escribió:
    >
    > > I'm using in my script command os.system('command') on Windows XP.
    > > Each time the os.system command is used, python opens an empty ms-dos
    > > command window (the black one) and then closes it. So when in one
    > > script the os.system command 50 times is used, I see 50 black windows.

    >
    > > Is there a way of how to suppress this unnecessary command windows to
    > > be opened?

    >
    > Use the subprocess module instead of os.system
    >
    > --
    > Gabriel Genellina


    I'm on version 2.2.1 because of a program we use and it uses this
    version.

    and the subprocess module was implemented in version 2.4

    Any possibility to do it with the old stuff in ver 2.2.1?

    Thx
    boriq, Jun 12, 2008
    #3
  4. En Thu, 12 Jun 2008 07:08:00 -0300, boriq <>
    escribió:

    > On 12 Jun., 11:51, "Gabriel Genellina" <> wrote:
    >> En Thu, 12 Jun 2008 05:28:13 -0300, boriq <>  
    >> escribió:
    >>
    >> > I'm using in my script command os.system('command') on Windows XP.
    >> > Each time the os.system command is used, python opens an empty ms-dos
    >> > command window (the black one) and then closes it. So when in one
    >> > script the os.system command 50 times is used, I see 50 black windows.

    >>
    >> > Is there a way of how to suppress this unnecessary command windows to
    >> > be opened?

    >>
    >> Use the subprocess module instead of os.system
    >>

    >
    > I'm on version 2.2.1 because of a program we use and it uses this
    > version.
    >
    > and the subprocess module was implemented in version 2.4
    >
    > Any possibility to do it with the old stuff in ver 2.2.1?


    Sure, depending on your needs, use any of the os.popen variants or any of
    the os.spawn variants.

    --
    Gabriel Genellina
    Gabriel Genellina, Jun 12, 2008
    #4
  5. boriq

    Tim Golden Guest

    Gabriel Genellina wrote:
    > En Thu, 12 Jun 2008 07:08:00 -0300, boriq <>
    > escribió:
    >
    >> On 12 Jun., 11:51, "Gabriel Genellina" <> wrote:
    >>> En Thu, 12 Jun 2008 05:28:13 -0300, boriq <>
    >>> escribió:
    >>>
    >>> > I'm using in my script command os.system('command') on Windows XP.
    >>> > Each time the os.system command is used, python opens an empty ms-dos
    >>> > command window (the black one) and then closes it. So when in one
    >>> > script the os.system command 50 times is used, I see 50 black windows.
    >>>
    >>> > Is there a way of how to suppress this unnecessary command windows to
    >>> > be opened?
    >>>
    >>> Use the subprocess module instead of os.system
    >>>

    >>
    >> I'm on version 2.2.1 because of a program we use and it uses this
    >> version.
    >>
    >> and the subprocess module was implemented in version 2.4
    >>
    >> Any possibility to do it with the old stuff in ver 2.2.1?

    >
    > Sure, depending on your needs, use any of the os.popen variants or any
    > of the os.spawn variants.


    Or you can download the external module which became the subprocess
    module in the stdlib:

    http://www.lysator.liu.se/~astrand/popen5/

    TJG
    Tim Golden, Jun 12, 2008
    #5
    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. Attila Feher
    Replies:
    0
    Views:
    656
    Attila Feher
    Aug 22, 2003
  2. Clara
    Replies:
    6
    Views:
    578
    Clara
    Apr 25, 2005
  3. notejam
    Replies:
    3
    Views:
    498
    Steve
    Nov 26, 2006
  4. Steven
    Replies:
    7
    Views:
    1,016
    Dennis Lee Bieber
    Sep 13, 2012
  5. fniles
    Replies:
    0
    Views:
    264
    fniles
    Apr 26, 2009
Loading...

Share This Page