-2

I have a GUI application and want it to be able to create a console with python interpreter in it. I want to redirect STDOUT and STDERR to it and export the namespace of my application there.

What's the simplest way to do that?

Boris Burkov
  • 13,420
  • 17
  • 74
  • 109

1 Answers1

1

You might want to look at the source code for IDLE which contains this functionality and is released as part of CPython. Specifically, PyShell.py looks to be relevant. You could probably just import idlelib.PyShell as a module and use its functionality.