Beginner's question: executing scripts under Win XP pro

  • Thread starter Jean-Claude Garreau
  • Start date
J

Jean-Claude Garreau

Hi,

I'm a beginner with python 2.4. I use it on Win XP Pro. I have no problems
with the GUI IDLE, but
when I copy the instructions in a script file, say 'test.py' and double
click on the file, I have just a
console window for a few moments, no output shown and the window closes
automatically before
I can do anything else. I am greatful if anyone can help me.

Please reply also to (e-mail address removed)

Thanks a lot,

Jean-Claude
 
I

ikshefem

there seems to be an error in your script.
Why don't you execute it directly from IDLE (F5) ? There, you should
see where the problem is.
 
J

Jean-Claude Garreau

Thank you for your answer. I did it. It executes perfectly in IDLE. I made a
copy/paste
from IDLE into the 'test.py' and I obseved the behavior I discribed. The
script is extremely simple
(it is just a test):

n=0

while( n<10 ):

print n,n*n

n+=1
 
S

Scott Souva

Hi,

I'm a beginner with python 2.4. I use it on Win XP Pro. I have no problems
with the GUI IDLE, but
when I copy the instructions in a script file, say 'test.py' and double
click on the file, I have just a
console window for a few moments, no output shown and the window closes
automatically before
I can do anything else. I am greatful if anyone can help me.

Please reply also to (e-mail address removed)

Thanks a lot,

Jean-Claude

Your script may be working properly, but XP simply removes the window
after the script runs. Here is a simple fix that will stop at the end
of the script and leave the Command window open:

print "Hello World"
raw_input()
 
J

J Correia

Scott Souva said:
Your script may be working properly, but XP simply removes the window
after the script runs. Here is a simple fix that will stop at the end
of the script and leave the Command window open:

print "Hello World"
raw_input()

That'll work (it waits for input from the user, and, as soon as it
receives it shuts down the window).

Another way to do it is instead of doubleclicking on the script,
open a command prompt window (Start>Run>cmd OR
Start>Programs>Accessories>Command Prompt) then type
'python test.py' at the prompt. Now the window stays open
until you specifically close it and you can rerun the script many times.

HTH,

JC
 
R

Roger Upole

Jean-Claude Garreau said:
Hi,

I'm a beginner with python 2.4. I use it on Win XP Pro. I have no problems with the GUI IDLE, but
when I copy the instructions in a script file, say 'test.py' and double click on the file, I have just a
console window for a few moments, no output shown and the window closes automatically before
I can do anything else. I am greatful if anyone can help me.

Please reply also to (e-mail address removed)

Thanks a lot,

Jean-Claude


Set the environment variable PYTHONINSPECT.
It causes the interpreter to halt at the interactive prompt
after the script runs so you can see the output.

Roger
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top