DOS problem (simple fix??)

Discussion in 'Python' started by Gavin Bauer, Jan 7, 2005.

  1. Gavin Bauer

    Gavin Bauer Guest

    My DOS window (running in windows ME) closes the second it finishes
    running my programs. As you can imagine, this makes it hard to see the
    results. I've gotten in the habit of putting raw_input("Press enter to
    exit") at the end of every program, and in addition to being pain in
    the butt, it often fails to work. Being new to programming in general,
    I make more mistakes than most people. My programs often have errors
    before they get to my raw_input command. They then display the error
    and immediately close. It is naturally a lot easier to fix an error
    when you know what the error is. This makes debugging even more
    annoying than it ordinarily would be, if you can imagine that. I've
    heard that it should be a simple preference fix, but I've asked around
    and no one seems to know how.

    Thank you, and please make all answers simple enough to be understood
    by a highschool student and his father :) .
     
    Gavin Bauer, Jan 7, 2005
    #1
    1. Advertising

  2. Gavin Bauer

    Guest

    When I have a Python script generating a lot of output, I either open
    an output file and then print to it with

    fp = open("results.txt","w")
    print>>fp,"stuff"

    or I redirect output to a file from the command line using ">" (also
    works on Unix), for example

    python foo.py > results.txt

    An alternative is to open a shell buffer within Emacs or XEmacs, two
    text editors with Python modes. You can run a Python script from within
    the shell buffer, and the results will be printed there. You can move
    around the shell buffer as if it were a file.
     
    , Jan 7, 2005
    #2
    1. Advertising

  3. Gavin Bauer

    Paul Rubin Guest

    Gavin Bauer <> writes:
    > Thank you, and please make all answers simple enough to be understood
    > by a highschool student and his father :) .


    You might like to try IDLE, which is included with Python.
     
    Paul Rubin, Jan 7, 2005
    #3
  4. Gavin Bauer

    Steve Holden Guest

    Gavin Bauer wrote:

    > My DOS window (running in windows ME) closes the second it finishes
    > running my programs. As you can imagine, this makes it hard to see the
    > results. I've gotten in the habit of putting raw_input("Press enter to
    > exit") at the end of every program, and in addition to being pain in
    > the butt, it often fails to work. Being new to programming in general,
    > I make more mistakes than most people. My programs often have errors
    > before they get to my raw_input command. They then display the error
    > and immediately close. It is naturally a lot easier to fix an error
    > when you know what the error is. This makes debugging even more
    > annoying than it ordinarily would be, if you can imagine that. I've
    > heard that it should be a simple preference fix, but I've asked around
    > and no one seems to know how.
    >

    I presume this means you are starting the program by the time-honored
    expedient of double-clicking on it. For debugging you would probably
    find it more satisfactory to run your programs from the command line,
    and there's a FAQ that explains how at

    http://www.python.org/doc/faq/windows.html

    If that isn't simple enough then please let me know, as it's *supposed*
    to be.

    > Thank you, and please make all answers simple enough to be understood
    > by a highschool student and his father :) .


    If you wanted to get really adventurous you could try tweaking the
    command that Windows runs when you double-click a Python script, but
    we'll leave that for another time.

    Welcome to Python!

    regards
    Steve
    --
    Steve Holden http://www.holdenweb.com/
    Python Web Programming http://pydish.holdenweb.com/
    Holden Web LLC +1 703 861 4237 +1 800 494 3119
     
    Steve Holden, Jan 8, 2005
    #4
    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. Patrick Philippot
    Replies:
    0
    Views:
    467
    Patrick Philippot
    Apr 14, 2006
  2. Xah Lee
    Replies:
    22
    Views:
    1,140
    Tim Roberts
    Mar 21, 2006
  3. Ben Fairbank
    Replies:
    2
    Views:
    5,460
  4. Xah Lee
    Replies:
    23
    Views:
    1,086
    Tim Roberts
    Mar 21, 2006
  5. Xah Lee
    Replies:
    21
    Views:
    806
    Tim Roberts
    Mar 21, 2006
Loading...

Share This Page