How to obtain a 'interactive session' of a script?

Bo Peng bpeng at
Sun Sep 18 18:22:19 CEST 2005

jepler at wrote:
> The 'code' module contains 'Utilities needed to emulate Python's interactive
> interpreter.'.  By subclassing code.InteractiveConsole and replacing the
> raw_input method with one which reads from a file, I think you can get what you
> want.

This method works fine with only one minor problem. It would stop 
(waiting for user input) at help(str) command. I will have to find a way 
to feed the program with'q' etc.


More information about the Python-list mailing list