irritating problem

Discussion in 'Python' started by Park997, Sep 15, 2003.

  1. Park997

    Park997 Guest

    Hi,

    I have a script that runs correctly in IDLE, runs correctly when invoked in the
    Command Prompt (Win XP), runs correctly from Komodo, but flashes a black box
    too fast to see when the icon is double clicked and produces no output. There
    are no error meassages from any of the methods that produce output. All of the
    other modules in the same directory (these are imported to the problem module)
    work correctly in any start mode.

    python 2.3.

    Obviously this isn't a disaster, but it "bugs" me. Is there a fix or method of
    obtaining diagnostic information on this?

    Thanks,

    Wendell Cropper
     
    Park997, Sep 15, 2003
    #1
    1. Advertising

  2. Quoting Park997 ():
    > Hi,
    >
    > I have a script that runs correctly in IDLE, runs correctly when
    > invoked in the Command Prompt (Win XP), runs correctly from Komodo,
    > but flashes a black box too fast to see when the icon is double
    > clicked and produces no output. There are no error meassages from
    > any of the methods that produce output. All of the other modules in
    > the same directory (these are imported to the problem module) work
    > correctly in any start mode.


    It would be useful to know specifically what output you are expecting
    versus what output you are getting.

    If it's flashing the box and disappearing, it's conceivable that you
    could change the properties such that the cmd window doesn't disappear
    after the program completes, right?

    Thanks,
    --G.

    --
    Geoff Gerrietts "I think doorways are sexist."
    <geoff at gerrietts net> --Jayson Lockwood
     
    Geoff Gerrietts, Sep 15, 2003
    #2
    1. Advertising

  3. Park997

    Peter Hansen Guest

    Park997 wrote:
    >
    > I have a script that runs correctly in IDLE, runs correctly when invoked in the
    > Command Prompt (Win XP), runs correctly from Komodo, but flashes a black box
    > too fast to see when the icon is double clicked and produces no output. There
    > are no error meassages from any of the methods that produce output. All of the
    > other modules in the same directory (these are imported to the problem module)
    > work correctly in any start mode.


    Can you select Properties for that icon and change it so it doesn't close
    the window automatically when the program terminates?

    Or is this just using the default settings after you've installed Python,
    in which case it's being run using the assocation for the .py file extension?
    In that case, you should go to Explorer, under View->Folder Options. Then
    click the File Types tab, scroll down until you find the entry for the Python
    files (make sure you use .py or .pyw as appropriate), then click on Edit,
    then on Run in the Actions area, then on Edit. You should then see, in about
    the 19th dialog that has popped up (isn't Windows wonderful?! Truly those at
    Microsoft are masters of good user interface design!), the actual command
    that is being executed when you click on the icon. I suspect it uses the
    directory that the .py file is in as the current directory, and it should
    show an absolute path to where it thinks Python should be, then something
    like "%1" %* which roughly means execute the file using the exact command
    plus the filename in quotation marks. I suspect the %* does nothing in most
    cases.

    If you can then go to the DOS prompt in the same directory, and type the
    same command, and everything works.... well then you've got a problem on
    your hands, don't you? ;-) (But let us know more, then, as there are
    doubtless other steps to take.)

    -Peter
     
    Peter Hansen, Sep 15, 2003
    #3
  4. Park997

    John Roth Guest

    "Park997" <> wrote in message
    news:...
    > Hi,
    >
    > I have a script that runs correctly in IDLE, runs correctly when invoked

    in the
    > Command Prompt (Win XP), runs correctly from Komodo, but flashes a black

    box
    > too fast to see when the icon is double clicked and produces no output.

    There
    > are no error meassages from any of the methods that produce output. All of

    the
    > other modules in the same directory (these are imported to the problem

    module)
    > work correctly in any start mode.
    >
    > python 2.3.
    >
    > Obviously this isn't a disaster, but it "bugs" me. Is there a fix or

    method of
    > obtaining diagnostic information on this?


    When you say "all of the other modules ... work correctly in any start
    mode,"
    do you mean that when you double click on the icon they come up in a dos
    box and the box stays around after the module exits? Or does your comment
    about importing them mean that you don't attempt to run them independently?

    There are *two* command prompts in Windows XP. One is the Command
    Prompt you seem to be using (the one with the "c:" icon), the other is the
    DOS box.
    It's cleverly hidden, but it still exists.

    The default action for both of them is to run the command and then exit
    immediately; that's why you get the black box that flashes and then
    vanishes.
    If your script provides a keyboard interface, the console window will stay
    around as long as you keep reading keyboard input; it will still go away
    immediately when you exit from the console loop and exit the Python script.

    There's no obvious way I know of to double click on a Python icon and
    have the XP console window stay around after the script exits. This is
    because
    Python itself invokes the command line processor, and there's no
    opportunity to pass it the -k (I think that's the one) parameter.

    What I do in the rare cases where I want to directly invoke a Python
    script and have the console window stay around is to create one
    (or sometimes two) .cmd files. The first .cmd file
    invokes a second copy of the XP command line with the -k parameter
    (which makes it stay around) and then Python itself.

    [cmdfile1.cmd example]

    cmd -k python myscript.py parameters...

    [end of command script]

    This doesn't allow you to set environment variables. If you want to
    do that, you need two .cmd files.

    [cmdfile1.cmd example]
    cmd -k cmdfile2.cmd
    [end of cmdfile1.cmd]

    [cmdfile2.cmd example]
    set envvar=somethingOrOther
    python myscript.py theWorldsGreatestParameter
    [end of cmdfile2.cmd]

    HTH

    John Roth


    >
    > Thanks,
    >
    > Wendell Cropper
     
    John Roth, Sep 16, 2003
    #4
  5. Park997

    Park997 Guest

    >Can you select Properties for that icon and change it so it doesn't close
    >the window automatically when the program terminates?
    >
    >Or is this just using the default settings after you've installed Python,
    >in which case it's being run using the assocation for the .py file extension?
    >In that case, you should go to Explorer, under View->Folder Options. Then
    >click the File Types tab, scroll down until you find the entry for the Python
    >files (make sure you use .py or .pyw as appropriate), then click on Edit,
    >then on Run in the Actions area, then on Edit. You should then see, in about
    >
    >the 19th dialog that has popped up (isn't Windows wonderful?! Truly those at
    >Microsoft are masters of good user interface design!), the actual command
    >that is being executed when you click on the icon. I suspect it uses the
    >directory that the .py file is in as the current directory, and it should
    >show an absolute path to where it thinks Python should be, then something
    >like "%1" %* which roughly means execute the file using the exact command
    >plus the filename in quotation marks. I suspect the %* does nothing in most
    >cases.
    >
    >If you can then go to the DOS prompt in the same directory, and type the
    >same command, and everything works.... well then you've got a problem on
    >your hands, don't you? ;-) (But let us know more, then, as there are
    >doubtless other steps to take.)
    >
    >-Peter
    >
    >
    >
    >
    >
    >


    Thanks to everybody for the help. It turns out that there are two separate
    python programs associated with the .py extention in windows. I have installed
    Python 2.3 over 2.22 and 2.0 without removing any of the previous versions.
    This is a numerical program using psyco (only available with the 2.3
    installation. When I comment out the psyco import, it runs the double clicked
    icon OK.

    Thanks again to everybody for the help.

    Wendell Cropper
     
    Park997, Sep 16, 2003
    #5
  6. On Mon, 15 Sep 2003 16:32:03 -0400, rumours say that Peter Hansen
    <> might have written:

    [snip]
    >(isn't Windows wonderful?! Truly those at
    >Microsoft are masters of good user interface design!)

    [snip]

    Playing the devil's advocate, an old joke about intuitive interfaces
    comes to mind (a recent reference:
    http://groups.google.com.gr/groups?selm=
    :)
    --
    TZOTZIOY, I speak England very best,
    Microsoft Security Alert: the Matrix began as open source.
     
    Christos TZOTZIOY Georgiou, Sep 16, 2003
    #6
  7. Park997

    Peter Hansen Guest

    Christos TZOTZIOY Georgiou wrote:
    >
    > On Mon, 15 Sep 2003 16:32:03 -0400, rumours say that Peter Hansen
    > <> might have written:
    >
    > [snip]
    > >(isn't Windows wonderful?! Truly those at
    > >Microsoft are masters of good user interface design!)

    > [snip]
    >
    > Playing the devil's advocate, an old joke about intuitive interfaces
    > comes to mind (a recent reference:
    > http://groups.google.com.gr/groups?selm=
    > :)


    Cute. That must explain the prevalence of so much "nipple-ware" on the web
    these days... ;-)

    -Peter
     
    Peter Hansen, Sep 16, 2003
    #7
    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. Andreas Suurkuusk
    Replies:
    0
    Views:
    3,980
    Andreas Suurkuusk
    Jul 27, 2003
  2. sachin bond
    Replies:
    0
    Views:
    270
    sachin bond
    Sep 11, 2003
  3. Axel Dahmen

    Web Site Manager: irritating data

    Axel Dahmen, Oct 27, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    264
    Axel Dahmen
    Oct 27, 2006
  4. Replies:
    6
    Views:
    524
    =?Utf-8?B?TWlsb3N6IFNrYWxlY2tpIFtNQ0FEXQ==?=
    Feb 12, 2007
  5. Mike

    Problem problem problem :( Need Help

    Mike, May 7, 2004, in forum: ASP General
    Replies:
    2
    Views:
    549
    Bullschmidt
    May 11, 2004
Loading...

Share This Page