Beginner's question: executing scripts under Win XP pro

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jean-Claude Garreau

    #1

    Beginner's question: executing scripts under Win XP pro

    Hi,

    I'm a beginner with python 2.4. I use it on Win XP Pro. I have no problems
    with the GUI IDLE, but
    when I copy the instructions in a script file, say 'test.py' and double
    click on the file, I have just a
    console window for a few moments, no output shown and the window closes
    automatically before
    I can do anything else. I am greatful if anyone can help me.

    Please reply also to jean-claude.garreau@ univ-lille1.fr

    Thanks a lot,

    Jean-Claude


  • ikshefem@gmail.com

    #2
    Re: Beginner's question: executing scripts under Win XP pro

    there seems to be an error in your script.
    Why don't you execute it directly from IDLE (F5) ? There, you should
    see where the problem is.

    Comment

    • Jean-Claude Garreau

      #3
      Re: Beginner's question: executing scripts under Win XP pro

      Thank you for your answer. I did it. It executes perfectly in IDLE. I made a
      copy/paste
      from IDLE into the 'test.py' and I obseved the behavior I discribed. The
      script is extremely simple
      (it is just a test):

      n=0

      while( n<10 ):

      print n,n*n

      n+=1

      <ikshefem@gmail .com> a écrit dans le message de news:
      1143297721.0075 21.7910@e56g200 0c...legrou ps.com...[color=blue]
      > there seems to be an error in your script.
      > Why don't you execute it directly from IDLE (F5) ? There, you should
      > see where the problem is.
      >[/color]


      Comment

      • Scott Souva

        #4
        Re: Beginner's question: executing scripts under Win XP pro

        On Sat, 25 Mar 2006 14:45:34 +0100, "Jean-Claude Garreau"
        <jean-claude.garreau@ univ-lille1.fr> wrote:
        [color=blue]
        >Hi,
        >
        >I'm a beginner with python 2.4. I use it on Win XP Pro. I have no problems
        >with the GUI IDLE, but
        >when I copy the instructions in a script file, say 'test.py' and double
        >click on the file, I have just a
        >console window for a few moments, no output shown and the window closes
        >automaticall y before
        >I can do anything else. I am greatful if anyone can help me.
        >
        >Please reply also to jean-claude.garreau@ univ-lille1.fr
        >
        >Thanks a lot,
        >
        > Jean-Claude
        >[/color]

        Your script may be working properly, but XP simply removes the window
        after the script runs. Here is a simple fix that will stop at the end
        of the script and leave the Command window open:

        print "Hello World"
        raw_input()

        Comment

        • J Correia

          #5
          Re: Beginner's question: executing scripts under Win XP pro


          "Scott Souva" <ssouva@spambit es.twcny.rr.com > wrote in message
          news:7bna22hp2b j8svrmbof0n6jg6 q58oa27i6@4ax.c om...[color=blue]
          > Your script may be working properly, but XP simply removes the window
          > after the script runs. Here is a simple fix that will stop at the end
          > of the script and leave the Command window open:
          >
          > print "Hello World"
          > raw_input()[/color]

          That'll work (it waits for input from the user, and, as soon as it
          receives it shuts down the window).

          Another way to do it is instead of doubleclicking on the script,
          open a command prompt window (Start>Run>cmd OR
          Start>Programs> Accessories>Com mand Prompt) then type
          'python test.py' at the prompt. Now the window stays open
          until you specifically close it and you can rerun the script many times.

          HTH,

          JC


          Comment

          • Roger Upole

            #6
            Re: Beginner's question: executing scripts under Win XP pro

            "Jean-Claude Garreau" <jean-claude.garreau@ univ-lille1.fr> wrote in message news:e03hdc$k7v $1@chouia2.univ-lille1.fr...[color=blue]
            > Hi,
            >
            > I'm a beginner with python 2.4. I use it on Win XP Pro. I have no problems with the GUI IDLE, but
            > when I copy the instructions in a script file, say 'test.py' and double click on the file, I have just a
            > console window for a few moments, no output shown and the window closes automatically before
            > I can do anything else. I am greatful if anyone can help me.
            >
            > Please reply also to jean-claude.garreau@ univ-lille1.fr
            >
            > Thanks a lot,
            >
            > Jean-Claude[/color]


            Set the environment variable PYTHONINSPECT.
            It causes the interpreter to halt at the interactive prompt
            after the script runs so you can see the output.

            Roger




            ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
            http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
            ---= East/West-Coast Server Farms - Total Privacy via Encryption =---

            Comment

            Working...