Running Python programmes

D

David

I am an absolute beginner and am working through the book Python Programming for the Absolute Beginner by Michael Dawson. Everything is fine except if I run a scripted programme, or one I have downloaded, and then run another one, the second one will not run, I just get the >>> in the interactive window. I have to exit Python and start again, when the second programme then runs fine.

Any suggestions much appreciated.

David
 
C

Colin J. Williams

I am an absolute beginner and am working through the book Python Programming for the Absolute Beginner by Michael Dawson. Everything is fine except if I run a scripted programme, or one I have downloaded, and then run another one, the second one will not run, I just get the >>> in the interactive window. I have to exit Python and start again, when the second programme then runs fine.

Any suggestions much appreciated.

David

David,

Perhaps you could show a very small program, maybe 3 or 4 lines, that
illustrates the problem.

Python 3? Windows? Using Idle?

Colin W.
 
D

Dave Angel

You leave out a lot of details, including what version of Python, what
OS, how you're running these "programmes" and what you mean "will not
run."

For example, if you're on Linux, running Python 3.3, and you're running
these "programmes" from the bash prompt,

$ python3.3 prog1.py
some results

$ python3.3 prog2.py
some other results

I'd be amazed if you even saw the >>>> prompt.
 
D

darnold

Maybe you're inadvertently running Python with either the '-i' switch or with the PYTHONINSPECT environment variable set?
When you do that, your script will launch an interactive prompt after it completes.


C:\Python27>echo print "hello" > hello.py

C:\Python27>python hello.py
hello

C:\Python27>python -i hello.py
hello

C:\Python27>set PYTHONINSPECT=1

C:\Python27>python hello.py
hello
 

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,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top