Help running pythonw from a command prompt with arguments

Discussion in 'Python' started by Eric Ching, Mar 3, 2004.

  1. Eric Ching

    Eric Ching Guest

    Can I run pythonw with a script that takes command line arguments then
    launches a GUI? I try pythonw myscript.pyw -option arg (etc.) and
    nothing happens. Nothing, as in I am immediately returned to the DOS
    prompt.

    I just started learning Python a couple of weeks ago, so please bear
    with me. I have a script that(for now) uses command line arguments
    then launches a window (Tk). Once I have entered the arguments and
    the window is launched I do not want the window to be dependent on the
    DOS window. I understand that pythonw gets around this, however I am
    not having much luck. Thanks in advance for your help, Eric
    Eric Ching, Mar 3, 2004
    #1
    1. Advertising

  2. On 3 Mar 2004 07:18:50 -0800, (Eric Ching)
    declaimed the following in comp.lang.python:

    > Can I run pythonw with a script that takes command line arguments then
    > launches a GUI? I try pythonw myscript.pyw -option arg (etc.) and
    > nothing happens. Nothing, as in I am immediately returned to the DOS
    > prompt.
    >

    I don't think starting from a command line is any different
    between "pythonw" and "python", they only show a difference when started
    via "Windows" methods (double-clicking on an icon), where "python" will
    CREATE stdio window vs "pythonw" suppressing that window.

    Launching a GUI can be done from command line using the regular
    "python" command, since the command line window is pre-existing.

    > the window is launched I do not want the window to be dependent on the
    > DOS window. I understand that pythonw gets around this, however I am


    No.. pythonw only suppresses the creation of a console-type
    window for applications that don't use stdio when when started from
    Windows. Since you already have a console window the use of "pythonw" is
    meaningless. If you mean you want the program to run "detached" from the
    console then you probably need to use the Windows means of starting such
    tasks:

    start pythonw <script> <options>

    "start" runs the rest of the command disconnected from the console; in
    this situation "python" would realize it had no console and open a
    window, "pythonw" would suppress the window expecting the program to
    manage I/O via a GUI.


    If you are getting nothing, the first thing I'd try is using
    "python" rather than "pythonw" and see if some error trace shows up. As
    "pythonw" is meant to suppress the creation of a stdio console, it
    probably also doesn't take advantage of the one you have active, so all
    stdio (including stderr) is suppressed.


    --
    > ============================================================== <
    > | Wulfraed Dennis Lee Bieber KD6MOG <
    > | Bestiaria Support Staff <
    > ============================================================== <
    > Home Page: <http://www.dm.net/~wulfraed/> <
    > Overflow Page: <http://wlfraed.home.netcom.com/> <
    Dennis Lee Bieber, Mar 3, 2004
    #2
    1. Advertising

  3. Eric Ching

    Eric Ching Guest

    I post too soon. Looks like my problem is not so much with using
    command line arguments as it is simply with pythonw. When I try using
    pythonw with a script that works with the standard python
    interpreter(after changing the extension to pyw), still I get the same
    results(returns immediately to the command prompt) When I double
    click on this script's icon nothing happens as well.
    Eric Ching, Mar 3, 2004
    #3
    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. Chaos
    Replies:
    1
    Views:
    416
  2. chrisdude911
    Replies:
    10
    Views:
    135,393
    srk289
    Mar 10, 2009
  3. Replies:
    1
    Views:
    498
    Steve Potter
    Mar 17, 2007
  4. Albert
    Replies:
    6
    Views:
    362
  5. Replies:
    11
    Views:
    100
Loading...

Share This Page