run this file (test.py) as: def finish(): print '\n', "bye", '\n' raw_input('Press Enter to quit: ')
finish() $python -i test.py A second approach could be: def finish(): import os, subprocess print '\n', "bye", '\n' raw_input('Press Enter to quit: ') subprocess.call('python') finish() $python test.py bye Press Enter to quit: Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51) [GCC 4.2.1 (Apple Inc. build 5646)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> A word of caution, am not using IDLE and preferably you should avoid it too. ~l0nwlf On Wed, Mar 24, 2010 at 2:46 AM, bob gailer <bgai...@gmail.com> wrote: > On 3/23/2010 4:47 PM, Wayne Watson wrote: > >> I use this code to quit a completed program. If no is selected for the >> yes/no prompt, warning messages appear in the shell window. >> > > What is the yes/no prompt? Is it in your program or is it a feature of > IDLE? > > What are the warning messages? > > > I'm executing from IDLE. Is there a way to just return to the >>> prompt >> there? >> >> def finish(): >> print; print "Bye" >> print >> raw_input('Press Enter to quit') >> sys.exit() >> >> > > -- > Bob Gailer > 919-636-4239 > Chapel Hill NC > > > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor >
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor