Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Keeping the Console Open with IDLE

Reply
Thread Tools

Keeping the Console Open with IDLE

 
 
Gabriel Genellina
Guest
Posts: n/a
 
      02-20-2009
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

 
Reply With Quote
 
 
 
 
Gabriel Genellina
Guest
Posts: n/a
 
      02-20-2009
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

 
Reply With Quote
 
 
 
 
W. eWatson
Guest
Posts: n/a
 
      02-20-2009
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/>

 
Reply With Quote
 
W. eWatson
Guest
Posts: n/a
 
      02-20-2009
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/>

 
Reply With Quote
 
David Smith
Guest
Posts: n/a
 
      02-20-2009
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
 
Reply With Quote
 
Catherine Heathcote
Guest
Posts: n/a
 
      02-20-2009
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.
 
Reply With Quote
 
W. eWatson
Guest
Posts: n/a
 
      02-20-2009
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/>

 
Reply With Quote
 
Gabriel Genellina
Guest
Posts: n/a
 
      02-20-2009
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

 
Reply With Quote
 
MRAB
Guest
Posts: n/a
 
      02-20-2009
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.
 
Reply With Quote
 
W. eWatson
Guest
Posts: n/a
 
      02-20-2009
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/>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Keeping console window open Fencer Python 3 06-08-2009 12:41 AM
Keeping the console window K Viltersten Python 3 03-02-2008 05:02 PM
Re: console mp3->wav decoder for $indows or GUI one which supports console Serge Terekhoff Python 0 06-30-2003 12:36 PM
Re: console mp3->wav decoder for $indows or GUI one which supports console Egor Bolonev Python 0 06-30-2003 10:43 AM
Re: console mp3->wav decoder for $indows or GUI one which supports console Ben Finney Python 2 06-30-2003 05:43 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57