help function in python opens a command windows
In the latest PythonEngine.pas the python help function opens a command window instead of redirecting to the open console.
I used Demo 1 and I tried to run the following: print(2+2) import os print("Hello") help(os)
See also image below

It has always been like this.
If you run python in embedded mode, the help() function starts a new console and displays the help. The function does not return until the console is closed.
If you want to see help in the output window you can use the following.
def myhelp(ob):
import sys
import pydoc
s = pydoc.getdoc(ob)
print(s)
and even replace the builtin function with your own.
builtins.help = myhelp
I found that this update of Dec 22, 2020 is responsible for this change in behavior: https://github.com/pyscripter/python4delphi/commit/708064f00993c6bf16294b69628403d217ac0824#diff-4e6e82ecc31f655224471f68dc6087a860c1260c3aea6f61288e66663122ec8c
My understanding is that having 'isatty()' returning True makes Python believe that a terminal is connected. Is it perhaps possible to make this configurable? I also found that e.g. 'help(os)' is more extensive than pydoc.getdoc(os), so this is not a full solution.
@LennertP You are right. Removing the isatty stuff sends the output to stdout.
The Isatty was introduced by PR #261 because "pip module requires this method in stdout".
I am reopening the issue and I will think about it.
Perhaps we can keep the isatty() function but make the return value (True/False) configurable?
After some reflection, I concluded that isatty should stay (so that pip is happy), but it is more appropriate to return False.
This sorts out this issue, and prevent pip and other apps sending non printable control characters to the output.
Indeed, this does the job! Thank you for resolving this issue.