python script help...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shorty9588
    New Member
    • May 2006
    • 2

    python script help...

    Hi, I am new to this site and to programming.

    I have been trying to program with Python, however I don`t know :confused: how to run scripts. I have created some in Windows notepad (I use windows xp) and succesfully added the ".py" extension. However, when I try to run the script, a python window will just blink and then disappear. I have tried a billion times! :mad:
    How can I solve this problem?

    THanks.
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    Sounds like you may be trying to run the script by double clicking on explorer or something like that. Try starting a command prompt (Start Menu -> Run and type cmd) and run the Python script there. You will probably need to change to the directory that the scripts are in first just to make things easier.

    Comment

    • shorty9588
      New Member
      • May 2006
      • 2

      #3
      thanks!

      I tried it but still nothing different happened . The command prompt told me that the directory I entered was not recognized :confused: . I am not very experienced with the command prompt so I think I must be entering something wrong (I am such an amateur! :o )... However I downloaded Activepython 2.4 and the python IDE was able to run and process my script. I still don`t know how to make the original command line run it but this activepython somehow did it. THanks anyway :) . Your input is highly appreciated.

      Regards


      shorty9588

      Comment

      • bartonc
        Recognized Expert Expert
        • Sep 2006
        • 6478

        #4
        Originally posted by shorty9588
        I tried it but still nothing different happened . The command prompt told me that the directory I entered was not recognized :confused: . I am not very experienced with the command prompt so I think I must be entering something wrong (I am such an amateur! :o )... However I downloaded Activepython 2.4 and the python IDE was able to run and process my script. I still don`t know how to make the original command line run it but this activepython somehow did it. THanks anyway :) . Your input is highly appreciated.

        Regards


        shorty9588
        You can use the "raw_input" trick to keep the window from closing after your script has run. To do this, add the call:
        Code:
        raw_input("press a key to continue")
        as the last thing that your script does.

        Comment

        • Extremist
          New Member
          • Jan 2007
          • 94

          #5
          Originally posted by shorty9588
          Hi, I am new to this site and to programming.

          I have been trying to program with Python, however I don`t know :confused: how to run scripts. I have created some in Windows notepad (I use windows xp) and succesfully added the ".py" extension. However, when I try to run the script, a python window will just blink and then disappear. I have tried a billion times! :mad:
          How can I solve this problem?

          THanks.
          Let's start at base. Download the Python package from the sourceforce.net website. If you have difficulty with this, google 'download python' and just look for it.
          Then when you finished downloading it, run the setup program in windows and
          follow the prompts.
          Now, what you do is simple:
          You click on Start,Programs and you will see that there is a program python24 or whatever version you installed. Click on it
          A new window will open, here you can enter some python code and get it compiled one line at a time.
          If however it is not you liking to do it that way, click on File, New Window and a new window will open, enter your code and click on run (I'm a little rustic on the exact words but one of the menubar menus will have run inside it at least.
          And thats it
          Hope you get it right

          Comment

          Working...