from cStringIO import StringIO import pdb str_input = StringIO("""help continue """) debugger = pdb.Pdb(stdin = str_input) debugger.use_rawinput = False debugger.set_trace() print "Hello, world!"