code: def loop(self):
          
          while True:
              with self.setup_readline():
                  try:
                      line = input(self.prompt)
                  except EOFError:
                      _vprinterr('^D')
                      break
                  except KeyboardInterrupt:
                      _vprinterr('^C')
                      continue
              if not line.strip():
                  continue
              try:
                  cmd, args = self.cmd_split(line)
              except KeyError as e:
                  _vprinterr('<red>Invalid command: %s</red>' % e)
                  continue
              try:
                  cmd(argv=args)
              except SessionExit:
                  break
              except SystemExit as e:
                  pass
docs: Inner loop for interactive mode.  Do not call directly.