Keeping the Console Open with IDLE

Discussion in 'Python' started by W. eWatson, Feb 20, 2009.

  1. W. eWatson

    W. eWatson Guest

    I'm using IDLE for editing, but execute programs directly. If there are
    execution or "compile" errors, the console closes before I can see what it
    contains. How do I prevent that?
    --
    W. eWatson

    (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
    Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet

    Web Page: <www.speckledwithstars.net/>
     
    W. eWatson, Feb 20, 2009
    #1
    1. Advertising

  2. W. eWatson

    Matimus Guest

    On Feb 19, 8:06 pm, "W. eWatson" <> wrote:
    > I'm using IDLE for editing, but execute programs directly. If there are
    > execution or "compile" errors, the console closes before I can see what it
    > contains. How do I prevent that?
    > --
    >                                 W. eWatson
    >
    >               (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
    >                Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet
    >
    >                      Web Page: <www.speckledwithstars.net/>


    Open a console window and type in the name of the script rather than
    just double clicking on it. Or, you can terminate your script with a
    'raw_input("press enter to quit")'.

    Matt
     
    Matimus, Feb 20, 2009
    #2
    1. Advertising

  3. W. eWatson

    David Smith Guest

    W. eWatson wrote:
    > Matimus wrote:
    >> On Feb 19, 8:06 pm, "W. eWatson" <> wrote:
    >>> I'm using IDLE for editing, but execute programs directly. If there are
    >>> execution or "compile" errors, the console closes before I can see
    >>> what it
    >>> contains. How do I prevent that?
    >>> --
    >>> W. eWatson
    >>>
    >>> (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
    >>> Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet
    >>>
    >>> Web Page: <www.speckledwithstars.net/>

    >>
    >> Open a console window and type in the name of the script rather than
    >> just double clicking on it. Or, you can terminate your script with a
    >> 'raw_input("press enter to quit")'.
    >>
    >> Matt

    > I can open the Python command line from Start, but how do I navigate to
    > the folder where the program is?
    >


    I'm not sure whether I should feel old or write a smart alec comment --
    I suppose there are people in the world who don't know what to do with a
    command prompt....

    Assuming a Windows system:

    2. Type 'cd ' (as in Change Directory) in the command prompt window (w/o
    the single quote characters)
    3. Drag/drop the folder containing your python script to your command
    prompt window
    4. Hit enter in your command prompt window.
    5. Type python my_script_name.py to execute my_script_name.py.

    --David
     
    David Smith, Feb 20, 2009
    #3
  4. W. eWatson

    W. eWatson Guest


    >
    > I'm not sure whether I should feel old or write a smart alec comment --
    > I suppose there are people in the world who don't know what to do with a
    > command prompt....
    >
    > Assuming a Windows system:
    >
    > 2. Type 'cd ' (as in Change Directory) in the command prompt window (w/o
    > the single quote characters)
    > 3. Drag/drop the folder containing your python script to your command
    > prompt window
    > 4. Hit enter in your command prompt window.
    > 5. Type python my_script_name.py to execute my_script_name.py.
    >
    > --David

    If I enter just cd, then it tells me cd is not defined. If I enter
    c:/python25, it tells me I have a syntax error at c in c:. The title of the
    black background window I have up with a >>> prompt shown in it is
    "Python(command line)". Maybe this isn't the real Python console window?

    What I want is that if I execute the program by double clicking on its name
    to display the console window with the program or syntax errors shown
    without it closing in a split second. Putting read_raw in it doesn't work,
    since some error prevents it from ever being seen.

    --
    W. eWatson

    (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
    Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet

    Web Page: <www.speckledwithstars.net/>
     
    W. eWatson, Feb 20, 2009
    #4
  5. W. eWatson wrote:
    >
    >>
    >> I'm not sure whether I should feel old or write a smart alec comment --
    >> I suppose there are people in the world who don't know what to do with a
    >> command prompt....
    >>
    >> Assuming a Windows system:
    >>
    >> 2. Type 'cd ' (as in Change Directory) in the command prompt window (w/o
    >> the single quote characters)
    >> 3. Drag/drop the folder containing your python script to your command
    >> prompt window
    >> 4. Hit enter in your command prompt window.
    >> 5. Type python my_script_name.py to execute my_script_name.py.
    >>
    >> --David

    > If I enter just cd, then it tells me cd is not defined. If I enter
    > c:/python25, it tells me I have a syntax error at c in c:. The title of
    > the black background window I have up with a >>> prompt shown in it is
    > "Python(command line)". Maybe this isn't the real Python console window?
    >
    > What I want is that if I execute the program by double clicking on its
    > name to display the console window with the program or syntax errors
    > shown without it closing in a split second. Putting read_raw in it
    > doesn't work, since some error prevents it from ever being seen.
    >


    you need to open a dos prompt before doing the steps above. Go to
    start->run and hit "cmd" <enter> without the quotes.
     
    Catherine Heathcote, Feb 20, 2009
    #5
  6. W. eWatson

    W. eWatson Guest

    W. eWatson wrote:
    >
    >>
    >> I'm not sure whether I should feel old or write a smart alec comment --
    >> I suppose there are people in the world who don't know what to do with a
    >> command prompt....
    >>
    >> Assuming a Windows system:
    >>
    >> 2. Type 'cd ' (as in Change Directory) in the command prompt window (w/o
    >> the single quote characters)
    >> 3. Drag/drop the folder containing your python script to your command
    >> prompt window
    >> 4. Hit enter in your command prompt window.
    >> 5. Type python my_script_name.py to execute my_script_name.py.
    >>
    >> --David

    > If I enter just cd, then it tells me cd is not defined. If I enter
    > c:/python25, it tells me I have a syntax error at c in c:. The title of
    > the black background window I have up with a >>> prompt shown in it is
    > "Python(command line)". Maybe this isn't the real Python console window?
    >
    > What I want is that if I execute the program by double clicking on its
    > name to display the console window with the program or syntax errors
    > shown without it closing in a split second. Putting read_raw in it
    > doesn't work, since some error prevents it from ever being seen.
    >

    Whoa! What's going on here? I just looked at About IDLE, and it shows 1.2.2,
    but yet the second edition of Learning Python talks about going to 2.3 as
    the book is about to go to press, 2004. I thought IDLE came bundled with
    Python. I have Py 2.5. 1.2.2??? Puzzled.

    --
    W. eWatson

    (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
    Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet

    Web Page: <www.speckledwithstars.net/>
     
    W. eWatson, Feb 20, 2009
    #6
  7. En Fri, 20 Feb 2009 12:05:08 -0200, W. eWatson <>
    escribió:

    > Whoa! What's going on here? I just looked at About IDLE, and it shows
    > 1.2.2, but yet the second edition of Learning Python talks about going
    > to 2.3 as the book is about to go to press, 2004. I thought IDLE came
    > bundled with Python. I have Py 2.5. 1.2.2??? Puzzled.


    IDLE is a separate product; the version of IDLE that comes with Python
    2.5.4 is 1.2.4

    --
    Gabriel Genellina
     
    Gabriel Genellina, Feb 20, 2009
    #7
  8. W. eWatson

    W. eWatson Guest

    Gabriel Genellina wrote:
    > En Fri, 20 Feb 2009 12:05:08 -0200, W. eWatson <>
    > escribió:
    >
    >> Whoa! What's going on here? I just looked at About IDLE, and it shows
    >> 1.2.2, but yet the second edition of Learning Python talks about going
    >> to 2.3 as the book is about to go to press, 2004. I thought IDLE came
    >> bundled with Python. I have Py 2.5. 1.2.2??? Puzzled.

    >
    > IDLE is a separate product; the version of IDLE that comes with Python
    > 2.5.4 is 1.2.4
    >

    Where do I get 2.x.x, or the latest?

    --
    W. eWatson

    (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
    Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet

    Web Page: <www.speckledwithstars.net/>
     
    W. eWatson, Feb 20, 2009
    #8
  9. W. eWatson

    W. eWatson Guest

    Catherine Heathcote wrote:
    > W. eWatson wrote:
    >>
    >>>
    >>> I'm not sure whether I should feel old or write a smart alec comment --
    >>> I suppose there are people in the world who don't know what to do with a
    >>> command prompt....
    >>>
    >>> Assuming a Windows system:
    >>>
    >>> 2. Type 'cd ' (as in Change Directory) in the command prompt window (w/o
    >>> the single quote characters)
    >>> 3. Drag/drop the folder containing your python script to your command
    >>> prompt window
    >>> 4. Hit enter in your command prompt window.
    >>> 5. Type python my_script_name.py to execute my_script_name.py.
    >>>
    >>> --David

    >> If I enter just cd, then it tells me cd is not defined. If I enter
    >> c:/python25, it tells me I have a syntax error at c in c:. The title
    >> of the black background window I have up with a >>> prompt shown in it
    >> is "Python(command line)". Maybe this isn't the real Python console
    >> window?
    >>
    >> What I want is that if I execute the program by double clicking on its
    >> name to display the console window with the program or syntax errors
    >> shown without it closing in a split second. Putting read_raw in it
    >> doesn't work, since some error prevents it from ever being seen.
    >>

    >
    > you need to open a dos prompt before doing the steps above. Go to
    > start->run and hit "cmd" <enter> without the quotes.

    Something is amiss here. There's the MS Command Prompt, which I'm looking at
    right now. Yes, it has cd, and so on. I'm also looking at the Python command
    line window. It allow one to run interactively.

    If I write a simple python program with just raw_input, by clicking on the
    file name, I get a window with the the title "\Python25\pythonexe" that
    shows the prompt. If I deliberately put a syntax error in the program, and
    run it by clicking the file, then A window appears and disappears so quickly
    that I have no idea what it said. How do I keep that window up?

    Which, if any, of these is the real Python console? What is the window
    called in the example I gave with raw_input?

    --
    W. eWatson

    (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
    Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet

    Web Page: <www.speckledwithstars.net/>
     
    W. eWatson, Feb 20, 2009
    #9
  10. W. eWatson wrote:
    > Catherine Heathcote wrote:
    >> W. eWatson wrote:
    >>>
    >>>>
    >>>> I'm not sure whether I should feel old or write a smart alec comment --
    >>>> I suppose there are people in the world who don't know what to do
    >>>> with a
    >>>> command prompt....
    >>>>
    >>>> Assuming a Windows system:
    >>>>
    >>>> 2. Type 'cd ' (as in Change Directory) in the command prompt window
    >>>> (w/o
    >>>> the single quote characters)
    >>>> 3. Drag/drop the folder containing your python script to your command
    >>>> prompt window
    >>>> 4. Hit enter in your command prompt window.
    >>>> 5. Type python my_script_name.py to execute my_script_name.py.
    >>>>
    >>>> --David
    >>> If I enter just cd, then it tells me cd is not defined. If I enter
    >>> c:/python25, it tells me I have a syntax error at c in c:. The title
    >>> of the black background window I have up with a >>> prompt shown in
    >>> it is "Python(command line)". Maybe this isn't the real Python
    >>> console window?
    >>>
    >>> What I want is that if I execute the program by double clicking on
    >>> its name to display the console window with the program or syntax
    >>> errors shown without it closing in a split second. Putting read_raw
    >>> in it doesn't work, since some error prevents it from ever being seen.
    >>>

    >>
    >> you need to open a dos prompt before doing the steps above. Go to
    >> start->run and hit "cmd" <enter> without the quotes.

    > Something is amiss here. There's the MS Command Prompt, which I'm
    > looking at right now. Yes, it has cd, and so on. I'm also looking at the
    > Python command line window. It allow one to run interactively.
    >
    > If I write a simple python program with just raw_input, by clicking on
    > the file name, I get a window with the the title "\Python25\pythonexe"
    > that shows the prompt. If I deliberately put a syntax error in the
    > program, and run it by clicking the file, then A window appears and
    > disappears so quickly that I have no idea what it said. How do I keep
    > that window up?
    >
    > Which, if any, of these is the real Python console? What is the window
    > called in the example I gave with raw_input?
    >


    Run the program from within the MS command line, not by double clicking it.
     
    Catherine Heathcote, Feb 20, 2009
    #10
  11. En Fri, 20 Feb 2009 12:29:35 -0200, W. eWatson <>
    escribió:

    > Gabriel Genellina wrote:
    >> En Fri, 20 Feb 2009 12:05:08 -0200, W. eWatson
    >> <> escribió:
    >>
    >>> Whoa! What's going on here? I just looked at About IDLE, and it shows
    >>> 1.2.2, but yet the second edition of Learning Python talks about going
    >>> to 2.3 as the book is about to go to press, 2004. I thought IDLE came
    >>> bundled with Python. I have Py 2.5. 1.2.2??? Puzzled.

    >> IDLE is a separate product; the version of IDLE that comes with Python
    >> 2.5.4 is 1.2.4
    >>

    > Where do I get 2.x.x, or the latest?


    You may update your Python version to 2.5.4 (the latest release in the 2.5
    series). Then IDLE will report 1.2.4. They are separate products, their
    version numbers are uncorrelated.

    --
    Gabriel Genellina
     
    Gabriel Genellina, Feb 20, 2009
    #11
  12. En Fri, 20 Feb 2009 12:39:14 -0200, W. eWatson <>
    escribió:
    > Catherine Heathcote wrote:


    >> you need to open a dos prompt before doing the steps above. Go to
    >> start->run and hit "cmd" <enter> without the quotes.

    > Something is amiss here. There's the MS Command Prompt, which I'm
    > looking at right now. Yes, it has cd, and so on. I'm also looking at the
    > Python command line window. It allow one to run interactively.


    Open a command prompt ("CMD", "Console"), that black window you were
    looking at.
    Use the cd command to change directory to wherever your Python script is
    saved.
    Execute "python -V" (without the quotes). You should get a response,
    including the Python version number. If you get an error like "command not
    found" or similar, you'll have to use the whole path to python.exe -- try
    with "c:\python25\python -V" (again, no quotes).
    Once you know how to launch Python, you can:

    a) Enter the interactive interpreter: Just launch Python as above but
    without the -V argument. The prompt is now >>>
    You can type Python expressions and the interpreter evaluates them. You
    type 2+3, the interpreter answers 5; you type len("abc"), the interpreter
    answers 3...

    b) Or, from the command prompt, you can execute a script by launching
    Python the same way as above, passing the script name as an argument:

    c:\foo>python script_name.py

    This is what you were looking for - in case of syntax errors or something,
    you can see the output on the console. It stays open because it was open
    *before* you launched Python. Just keep the window open.

    See http://docs.python.org/using/windows.html for more info. If Python
    doesn't start just by typing "python", you may want to set your PATH
    environment variable as described there.

    --
    Gabriel Genellina
     
    Gabriel Genellina, Feb 20, 2009
    #12
  13. W. eWatson

    W. eWatson Guest

    Catherine Heathcote wrote:
    > W. eWatson wrote:
    >> Catherine Heathcote wrote:
    >>> W. eWatson wrote:
    >>>>
    >>>>>
    >>>>> I'm not sure whether I should feel old or write a smart alec
    >>>>> comment --
    >>>>> I suppose there are people in the world who don't know what to do
    >>>>> with a
    >>>>> command prompt....
    >>>>>
    >>>>> Assuming a Windows system:
    >>>>>
    >>>>> 2. Type 'cd ' (as in Change Directory) in the command prompt window
    >>>>> (w/o
    >>>>> the single quote characters)
    >>>>> 3. Drag/drop the folder containing your python script to your command
    >>>>> prompt window
    >>>>> 4. Hit enter in your command prompt window.
    >>>>> 5. Type python my_script_name.py to execute my_script_name.py.
    >>>>>
    >>>>> --David
    >>>> If I enter just cd, then it tells me cd is not defined. If I enter
    >>>> c:/python25, it tells me I have a syntax error at c in c:. The title
    >>>> of the black background window I have up with a >>> prompt shown in
    >>>> it is "Python(command line)". Maybe this isn't the real Python
    >>>> console window?
    >>>>
    >>>> What I want is that if I execute the program by double clicking on
    >>>> its name to display the console window with the program or syntax
    >>>> errors shown without it closing in a split second. Putting read_raw
    >>>> in it doesn't work, since some error prevents it from ever being seen.
    >>>>
    >>>
    >>> you need to open a dos prompt before doing the steps above. Go to
    >>> start->run and hit "cmd" <enter> without the quotes.

    >> Something is amiss here. There's the MS Command Prompt, which I'm
    >> looking at right now. Yes, it has cd, and so on. I'm also looking at
    >> the Python command line window. It allow one to run interactively.
    >>
    >> If I write a simple python program with just raw_input, by clicking on
    >> the file name, I get a window with the the title "\Python25\pythonexe"
    >> that shows the prompt. If I deliberately put a syntax error in the
    >> program, and run it by clicking the file, then A window appears and
    >> disappears so quickly that I have no idea what it said. How do I keep
    >> that window up?
    >>
    >> Which, if any, of these is the real Python console? What is the window
    >> called in the example I gave with raw_input?
    >>

    >
    > Run the program from within the MS command line, not by double clicking it.

    Shirley, you jest? DOS? To do this? How ugly. I barely recall the DOS
    commands. I get to drill my way down 4 levels of folders. What DOS cmd
    allows one to list only folders?

    Still, why would one design a window that disappears, when it has useful
    data in it? I see that if I click on the window, it has properties, width,
    height, etc.

    --
    W. eWatson

    (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
    Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet

    Web Page: <www.speckledwithstars.net/>
     
    W. eWatson, Feb 20, 2009
    #13
  14. W. eWatson

    W. eWatson Guest

    Gabriel Genellina wrote:
    > En Fri, 20 Feb 2009 12:29:35 -0200, W. eWatson <>
    > escribió:
    >
    >> Gabriel Genellina wrote:
    >>> En Fri, 20 Feb 2009 12:05:08 -0200, W. eWatson
    >>> <> escribió:
    >>>
    >>>> Whoa! What's going on here? I just looked at About IDLE, and it
    >>>> shows 1.2.2, but yet the second edition of Learning Python talks
    >>>> about going to 2.3 as the book is about to go to press, 2004. I
    >>>> thought IDLE came bundled with Python. I have Py 2.5. 1.2.2??? Puzzled.
    >>> IDLE is a separate product; the version of IDLE that comes with
    >>> Python 2.5.4 is 1.2.4
    >>>

    >> Where do I get 2.x.x, or the latest?

    >
    > You may update your Python version to 2.5.4 (the latest release in the
    > 2.5 series). Then IDLE will report 1.2.4. They are separate products,
    > their version numbers are uncorrelated.
    >

    Ah, I see, the book is referring to version 2.3 of Python and not IDLE.

    --
    W. eWatson

    (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
    Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet

    Web Page: <www.speckledwithstars.net/>
     
    W. eWatson, Feb 20, 2009
    #14
  15. W. eWatson

    David Smith Guest

    W. eWatson wrote:
    >
    >>
    >> I'm not sure whether I should feel old or write a smart alec comment --
    >> I suppose there are people in the world who don't know what to do with a
    >> command prompt....
    >>
    >> Assuming a Windows system:
    >>
    >> 2. Type 'cd ' (as in Change Directory) in the command prompt window (w/o
    >> the single quote characters)
    >> 3. Drag/drop the folder containing your python script to your command
    >> prompt window
    >> 4. Hit enter in your command prompt window.
    >> 5. Type python my_script_name.py to execute my_script_name.py.
    >>
    >> --David

    > If I enter just cd, then it tells me cd is not defined. If I enter
    > c:/python25, it tells me I have a syntax error at c in c:. The title of
    > the black background window I have up with a >>> prompt shown in it is
    > "Python(command line)". Maybe this isn't the real Python console window?
    >
    > What I want is that if I execute the program by double clicking on its
    > name to display the console window with the program or syntax errors
    > shown without it closing in a split second. Putting read_raw in it
    > doesn't work, since some error prevents it from ever being seen.
    >


    What I meant was open open the command prompt, type cd, space, DO NOT
    hit enter yet. Drag the folder with your script into the command prompt
    window. Then go to the command prompt window and hit enter. This
    should compose a command similar to the following:

    C:\Documents and Settings\user> cd "C:\Documents and Settings\user\My
    Documents\My Project"

    C:\Documents and Settings\user\My Documents\My Project> _

    --David
     
    David Smith, Feb 20, 2009
    #15
  16. W. eWatson wrote:
    > Catherine Heathcote wrote:
    >> W. eWatson wrote:
    >>> Catherine Heathcote wrote:
    >>>> W. eWatson wrote:
    >>>>>
    >>>>>>
    >>>>>> I'm not sure whether I should feel old or write a smart alec
    >>>>>> comment --
    >>>>>> I suppose there are people in the world who don't know what to do
    >>>>>> with a
    >>>>>> command prompt....
    >>>>>>
    >>>>>> Assuming a Windows system:
    >>>>>>
    >>>>>> 2. Type 'cd ' (as in Change Directory) in the command prompt
    >>>>>> window (w/o
    >>>>>> the single quote characters)
    >>>>>> 3. Drag/drop the folder containing your python script to your command
    >>>>>> prompt window
    >>>>>> 4. Hit enter in your command prompt window.
    >>>>>> 5. Type python my_script_name.py to execute my_script_name.py.
    >>>>>>
    >>>>>> --David
    >>>>> If I enter just cd, then it tells me cd is not defined. If I enter
    >>>>> c:/python25, it tells me I have a syntax error at c in c:. The
    >>>>> title of the black background window I have up with a >>> prompt
    >>>>> shown in it is "Python(command line)". Maybe this isn't the real
    >>>>> Python console window?
    >>>>>
    >>>>> What I want is that if I execute the program by double clicking on
    >>>>> its name to display the console window with the program or syntax
    >>>>> errors shown without it closing in a split second. Putting read_raw
    >>>>> in it doesn't work, since some error prevents it from ever being seen.
    >>>>>
    >>>>
    >>>> you need to open a dos prompt before doing the steps above. Go to
    >>>> start->run and hit "cmd" <enter> without the quotes.
    >>> Something is amiss here. There's the MS Command Prompt, which I'm
    >>> looking at right now. Yes, it has cd, and so on. I'm also looking at
    >>> the Python command line window. It allow one to run interactively.
    >>>
    >>> If I write a simple python program with just raw_input, by clicking
    >>> on the file name, I get a window with the the title
    >>> "\Python25\pythonexe" that shows the prompt. If I deliberately put a
    >>> syntax error in the program, and run it by clicking the file, then A
    >>> window appears and disappears so quickly that I have no idea what it
    >>> said. How do I keep that window up?
    >>>
    >>> Which, if any, of these is the real Python console? What is the
    >>> window called in the example I gave with raw_input?
    >>>

    >>
    >> Run the program from within the MS command line, not by double
    >> clicking it.

    > Shirley, you jest? DOS? To do this? How ugly. I barely recall the DOS
    > commands. I get to drill my way down 4 levels of folders. What DOS cmd
    > allows one to list only folders?
    >
    > Still, why would one design a window that disappears, when it has useful
    > data in it? I see that if I click on the window, it has properties,
    > width, height, etc.
    >


    Thats programming. Whaterver the language, you will need to be
    comfortable with the CLI of your operating system.
     
    Catherine Heathcote, Feb 20, 2009
    #16
  17. W. eWatson

    W. eWatson Guest

    David Smith wrote:
    > W. eWatson wrote:
    >>> I'm not sure whether I should feel old or write a smart alec comment --
    >>> I suppose there are people in the world who don't know what to do with a
    >>> command prompt....
    >>>
    >>> Assuming a Windows system:
    >>>
    >>> 2. Type 'cd ' (as in Change Directory) in the command prompt window (w/o
    >>> the single quote characters)
    >>> 3. Drag/drop the folder containing your python script to your command
    >>> prompt window
    >>> 4. Hit enter in your command prompt window.
    >>> 5. Type python my_script_name.py to execute my_script_name.py.
    >>>
    >>> --David

    >> If I enter just cd, then it tells me cd is not defined. If I enter
    >> c:/python25, it tells me I have a syntax error at c in c:. The title of
    >> the black background window I have up with a >>> prompt shown in it is
    >> "Python(command line)". Maybe this isn't the real Python console window?
    >>
    >> What I want is that if I execute the program by double clicking on its
    >> name to display the console window with the program or syntax errors
    >> shown without it closing in a split second. Putting read_raw in it
    >> doesn't work, since some error prevents it from ever being seen.
    >>

    >
    > What I meant was open open the command prompt, type cd, space, DO NOT
    > hit enter yet. Drag the folder with your script into the command prompt
    > window. Then go to the command prompt window and hit enter. This
    > should compose a command similar to the following:
    >
    > C:\Documents and Settings\user> cd "C:\Documents and Settings\user\My
    > Documents\My Project"
    >
    > C:\Documents and Settings\user\My Documents\My Project> _
    >
    > --David

    Ah, I thought I'd be clever and do a copy on the path name in the address
    area at the top of the folder. That doesn't work. I'm quite surprised though
    that one can do the drag as you say. But, hey, it works. Thanks. I wonder
    what else non-DOS things can be done in it?

    --
    W. eWatson

    (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
    Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet

    Web Page: <www.speckledwithstars.net/>
     
    W. eWatson, Feb 20, 2009
    #17
  18. En Fri, 20 Feb 2009 13:37:06 -0200, W. eWatson <>
    escribió:
    > Catherine Heathcote wrote:
    >> W. eWatson wrote:


    >> Run the program from within the MS command line, not by double
    >> clicking it.

    > Shirley, you jest? DOS? To do this? How ugly. I barely recall the DOS
    > commands. I get to drill my way down 4 levels of folders. What DOS cmd
    > allows one to list only folders?


    After executing these two commands, pressing TAB will auto-complete
    matching filenames/directories:

    reg add "HKLM\Software\Microsoft\Command Processor" /v CompletionChar /t
    REG_DWORD /d 9

    reg add "HKLM\Software\Microsoft\Command Processor" /v PathCompletionChar
    /t REG_DWORD /d 9

    (Overwrite the previous value, if exists). This is a global change and the
    logged on user must have administrative rights to modify the registry.
    Unprivileged users must use HKCU instead of HKLM.

    --
    Gabriel Genellina
     
    Gabriel Genellina, Feb 20, 2009
    #18
  19. W. eWatson

    MRAB Guest

    Catherine Heathcote wrote:
    > W. eWatson wrote:
    >> Catherine Heathcote wrote:
    >>> W. eWatson wrote:
    >>>>
    >>>>>
    >>>>> I'm not sure whether I should feel old or write a smart alec
    >>>>> comment --
    >>>>> I suppose there are people in the world who don't know what to do
    >>>>> with a
    >>>>> command prompt....
    >>>>>
    >>>>> Assuming a Windows system:
    >>>>>
    >>>>> 2. Type 'cd ' (as in Change Directory) in the command prompt window
    >>>>> (w/o
    >>>>> the single quote characters)
    >>>>> 3. Drag/drop the folder containing your python script to your command
    >>>>> prompt window
    >>>>> 4. Hit enter in your command prompt window.
    >>>>> 5. Type python my_script_name.py to execute my_script_name.py.
    >>>>>
    >>>>> --David
    >>>> If I enter just cd, then it tells me cd is not defined. If I enter
    >>>> c:/python25, it tells me I have a syntax error at c in c:. The title
    >>>> of the black background window I have up with a >>> prompt shown in
    >>>> it is "Python(command line)". Maybe this isn't the real Python
    >>>> console window?
    >>>>
    >>>> What I want is that if I execute the program by double clicking on
    >>>> its name to display the console window with the program or syntax
    >>>> errors shown without it closing in a split second. Putting read_raw
    >>>> in it doesn't work, since some error prevents it from ever being seen.
    >>>>
    >>>
    >>> you need to open a dos prompt before doing the steps above. Go to
    >>> start->run and hit "cmd" <enter> without the quotes.

    >> Something is amiss here. There's the MS Command Prompt, which I'm
    >> looking at right now. Yes, it has cd, and so on. I'm also looking at
    >> the Python command line window. It allow one to run interactively.
    >>
    >> If I write a simple python program with just raw_input, by clicking on
    >> the file name, I get a window with the the title "\Python25\pythonexe"
    >> that shows the prompt. If I deliberately put a syntax error in the
    >> program, and run it by clicking the file, then A window appears and
    >> disappears so quickly that I have no idea what it said. How do I keep
    >> that window up?
    >>
    >> Which, if any, of these is the real Python console? What is the window
    >> called in the example I gave with raw_input?
    >>

    >
    > Run the program from within the MS command line, not by double clicking it.
    >

    Or create a .bat file containing the commands to run the Python program,
    ending with the command "pause", which will wait for you to press a key
    when the program has quit.
     
    MRAB, Feb 20, 2009
    #19
  20. W. eWatson

    W. eWatson Guest

    W. eWatson wrote:
    > David Smith wrote:
    >> W. eWatson wrote:
    >>>> I'm not sure whether I should feel old or write a smart alec comment --
    >>>> I suppose there are people in the world who don't know what to do
    >>>> with a
    >>>> command prompt....
    >>>>
    >>>> Assuming a Windows system:
    >>>>
    >>>> 2. Type 'cd ' (as in Change Directory) in the command prompt window
    >>>> (w/o
    >>>> the single quote characters)
    >>>> 3. Drag/drop the folder containing your python script to your command
    >>>> prompt window
    >>>> 4. Hit enter in your command prompt window.
    >>>> 5. Type python my_script_name.py to execute my_script_name.py.
    >>>>
    >>>> --David
    >>> If I enter just cd, then it tells me cd is not defined. If I enter
    >>> c:/python25, it tells me I have a syntax error at c in c:. The title of
    >>> the black background window I have up with a >>> prompt shown in it is
    >>> "Python(command line)". Maybe this isn't the real Python console window?
    >>>
    >>> What I want is that if I execute the program by double clicking on its
    >>> name to display the console window with the program or syntax errors
    >>> shown without it closing in a split second. Putting read_raw in it
    >>> doesn't work, since some error prevents it from ever being seen.
    >>>

    >>
    >> What I meant was open open the command prompt, type cd, space, DO NOT
    >> hit enter yet. Drag the folder with your script into the command prompt
    >> window. Then go to the command prompt window and hit enter. This
    >> should compose a command similar to the following:
    >>
    >> C:\Documents and Settings\user> cd "C:\Documents and Settings\user\My
    >> Documents\My Project"
    >>
    >> C:\Documents and Settings\user\My Documents\My Project> _
    >>
    >> --David

    > Ah, I thought I'd be clever and do a copy on the path name in the
    > address area at the top of the folder. That doesn't work. I'm quite
    > surprised though that one can do the drag as you say. But, hey, it
    > works. Thanks. I wonder what else non-DOS things can be done in it?
    >

    Well, there is a difficulty with this method. The path is very long, and one
    must change the property width of the window. However, putting the name of a
    long py file further complicates this.

    The negative surprise here is that I'm trying to avoid executing the program
    in IDLE, because I'm told elsewhere it produced erroneous error msgs. They
    are exactly the same here. I'll take this up on another thread.



    --
    W. eWatson

    (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
    Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet

    Web Page: <www.speckledwithstars.net/>
     
    W. eWatson, Feb 20, 2009
    #20
    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. Ben Finney
    Replies:
    2
    Views:
    1,028
    Egor Bolonev
    Jun 30, 2003
  2. Egor Bolonev
    Replies:
    0
    Views:
    500
    Egor Bolonev
    Jun 30, 2003
  3. Serge Terekhoff
    Replies:
    0
    Views:
    662
    Serge Terekhoff
    Jun 30, 2003
  4. K Viltersten

    Keeping the console window

    K Viltersten, Mar 2, 2008, in forum: Python
    Replies:
    3
    Views:
    397
    K Viltersten
    Mar 2, 2008
  5. Fencer

    Keeping console window open

    Fencer, Jun 7, 2009, in forum: Python
    Replies:
    3
    Views:
    604
    Dave Angel
    Jun 8, 2009
Loading...

Share This Page