DOS problem (simple fix??)

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

    #1

    DOS problem (simple fix??)

    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("Pres s 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 :) .
  • beliavsky@aol.com

    #2
    Re: DOS problem (simple fix??)

    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.t xt","w")
    print>>fp,"stuf f"

    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.

    Comment

    • Paul Rubin

      #3
      Re: DOS problem (simple fix??)

      Gavin Bauer <gmanbauer@gmai l.com> writes:[color=blue]
      > Thank you, and please make all answers simple enough to be understood
      > by a highschool student and his father :) .[/color]

      You might like to try IDLE, which is included with Python.

      Comment

      • Steve Holden

        #4
        Re: DOS problem (simple fix??)

        Gavin Bauer wrote:
        [color=blue]
        > 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("Pres s 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.
        >[/color]
        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

        The official home of the Python Programming Language


        If that isn't simple enough then please let me know, as it's *supposed*
        to be.
        [color=blue]
        > Thank you, and please make all answers simple enough to be understood
        > by a highschool student and his father :) .[/color]

        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

        Comment

        Working...