[Tutor] cmd window

Prasad, Ramit ramit.prasad at jpmorgan.com
Tue Sep 13 21:09:02 CEST 2011


From: tutor-bounces+ramit.prasad=jpmorgan.com at python.org [mailto:tutor-bounces+ramit.prasad=jpmorgan.com at python.org] On Behalf Of Dinara Vakhitova
Sent: Tuesday, September 13, 2011 1:55 PM
To: Wayne Werner
Cc: tutor at python.org
Subject: Re: [Tutor] cmd window

Thank you a lot, it helped!
2011/9/13 Wayne Werner <waynejwerner at gmail.com<mailto:waynejwerner at gmail.com>>
On Tue, Sep 13, 2011 at 12:57 PM, Dinara Vakhitova <di.marvellous at gmail.com<mailto:di.marvellous at gmail.com>> wrote:
Hello,

Excuse me for my stupid question, but I'm an absolute beginner in programming.
I just would like to know what should I do in such case: when I run my program by clicking on the file itself, rather than from IDLE, the cmd window disappears just immediately after the output printing, so that I can't even see it. The solution must be very simple, but I can't find it in tutorials...

This is mainly because in later versions of Windows (XP onward, I believe) they changed a setting so that the command window would close after a program has executed. There are probably some more complicated settings to fix it on a global basis, but you'll find that most people add this line to the end of their programs:

raw_input("Press <Enter> to continue") # Use input() with Python 3.x

HTH,
Wayne



--
Yours faithfully,
Dinara Vakhitova



You can also run from command line. Start->run-> type "cmd" ->hit enter -> navigate to directory "cd c:\directory\with\python\filename.py"  (substitute the path you need) -> run script "python filename.py"

Ramit


Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423




This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110913/83d45fa8/attachment.html>


More information about the Tutor mailing list