MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / interact

Function interact

tools/python-3.11.9-amd64/Lib/code.py:278–301  ·  view source on GitHub ↗

Closely emulate the interactive Python interpreter. This is a backwards compatible interface to the InteractiveConsole class. When readfunc is not specified, it attempts to import the readline module to enable GNU readline if it is available. Arguments (all optional, all def

(banner=None, readfunc=None, local=None, exitmsg=None)

Source from the content-addressed store, hash-verified

276
277
278def interact(banner=None, readfunc=None, local=None, exitmsg=None):
279 """Closely emulate the interactive Python interpreter.
280
281 This is a backwards compatible interface to the InteractiveConsole
282 class. When readfunc is not specified, it attempts to import the
283 readline module to enable GNU readline if it is available.
284
285 Arguments (all optional, all default to None):
286
287 banner -- passed to InteractiveConsole.interact()
288 readfunc -- if not None, replaces InteractiveConsole.raw_input()
289 local -- passed to InteractiveInterpreter.__init__()
290 exitmsg -- passed to InteractiveConsole.interact()
291
292 """
293 console = InteractiveConsole(local)
294 if readfunc is not None:
295 console.raw_input = readfunc
296 else:
297 try:
298 import readline
299 except ImportError:
300 pass
301 console.interact(banner, exitmsg)
302
303
304if __name__ == "__main__":

Callers 1

code.pyFile · 0.85

Calls 2

interactMethod · 0.95
InteractiveConsoleClass · 0.85

Tested by

no test coverage detected