irritating problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Park997

    irritating problem

    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
  • Peter Hansen

    #2
    Re: irritating problem

    Park997 wrote:[color=blue]
    >
    > 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.[/color]

    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

    Comment

    • Geoff Gerrietts

      #3
      Re: irritating problem

      Quoting Park997 (park997@aol.co mnotospam):[color=blue]
      > 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.[/color]

      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

      Comment

      • John Roth

        #4
        Re: irritating problem


        "Park997" <park997@aol.co mnotospam> wrote in message
        news:2003091515 0042.22749.0000 1062@mb-m23.aol.com...[color=blue]
        > Hi,
        >
        > I have a script that runs correctly in IDLE, runs correctly when invoked[/color]
        in the[color=blue]
        > Command Prompt (Win XP), runs correctly from Komodo, but flashes a black[/color]
        box[color=blue]
        > too fast to see when the icon is double clicked and produces no output.[/color]
        There[color=blue]
        > are no error meassages from any of the methods that produce output. All of[/color]
        the[color=blue]
        > other modules in the same directory (these are imported to the problem[/color]
        module)[color=blue]
        > work correctly in any start mode.
        >
        > python 2.3.
        >
        > Obviously this isn't a disaster, but it "bugs" me. Is there a fix or[/color]
        method of[color=blue]
        > obtaining diagnostic information on this?[/color]

        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=somethin gOrOther
        python myscript.py theWorldsGreate stParameter
        [end of cmdfile2.cmd]

        HTH

        John Roth

        [color=blue]
        >
        > Thanks,
        >
        > Wendell Cropper[/color]


        Comment

        • Park997

          #5
          Re: irritating problem

          >Can you select Properties for that icon and change it so it doesn't close[color=blue]
          >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
          >
          >
          >
          >
          >
          >[/color]

          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

          Comment

          • Christos TZOTZIOY Georgiou

            #6
            Re: irritating problem

            On Mon, 15 Sep 2003 16:32:03 -0400, rumours say that Peter Hansen
            <peter@engcorp. com> might have written:

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

            Playing the devil's advocate, an old joke about intuitive interfaces
            comes to mind (a recent reference:

            :)
            --
            TZOTZIOY, I speak England very best,
            Microsoft Security Alert: the Matrix began as open source.

            Comment

            • Peter Hansen

              #7
              Re: irritating problem

              Christos TZOTZIOY Georgiou wrote:[color=blue]
              >
              > On Mon, 15 Sep 2003 16:32:03 -0400, rumours say that Peter Hansen
              > <peter@engcorp. com> might have written:
              >
              > [snip][color=green]
              > >(isn't Windows wonderful?! Truly those at
              > >Microsoft are masters of good user interface design!)[/color]
              > [snip]
              >
              > Playing the devil's advocate, an old joke about intuitive interfaces
              > comes to mind (a recent reference:
              > http://groups.google.com.gr/groups?s...40deadspam.com
              > :)[/color]

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

              -Peter

              Comment

              Working...