enter image description hereI'm working with Python 3.4.4 in Windows XP. When I run the .py file using double click on it, it only asks for user name & then terminates the command prompt suddenly. So I can't see final result. Here's my code:
from datetime import datetime
import time
from os import getcwd
import sys
name = input("Your name please: ")
print("Hello",name,",your system is:",sys.platform)
print("Your current work directory is:",getcwd())
print("Currenttime:",time.strftime("%a"),datetime.today(),time.strftime("%p"))
print("Thanks for trying. \u00a9 Gaz does Python")
input()
Can anyone help me, please? I've tried time.sleep()
but that doesn't work too.
** EDIT **
Did not see the last input. What I said is invalid. The prompt is probably dying like @eryksun said.
** Original answer **
The simplest answer is to open cmd.exe manually, navigate to your file and then execute your script with "python yourScript.py"
A Windows prompt exits when no processes are left running. When you double click on your file, the CMD is"associated" with the execution and exits upon it's completion. By running it beforehand manually "without purpose", there is no need for the prompt to exit as "he have another purpose".
You could also hack your way out by using one last input at the end of the program. That will force the prompt to wait for this input. (The infamous "PRESS ENTER TO CONTINUE" for example )