Hi stardiviner, > This minor patch should fixed ~py-shell~ initiate Python session issue.
It looks like this patch only affects users of python-mode.el. Since I don't use python-mode.el, I cannot test it. But the patch looks fine. Please add a commit message and changelog entry, and I'll merge it in. Now, a few general thoughts on python-mode.el: I'm a little surprised to see python-mode.el pop up, and that we have code in ob-python to explicitly support it. I thought it was obsolete ever since python.el was added to emacs 24. But, it looks like it's still receiving commits in 2020, so I guess I was wrong. In a sense, it doesn't seem right to have code in ob-python explicitly supporting python-mode.el. While at one point it may have been a contender with python.el as the standard Python mode, at this point it's just another third-party package like elpy, jedi, etc, none of which get explicit support. I don't want to break anyone's setup without further investigation, so I'll leave the python-mode.el support as is, for now. But a warning, this may change in future if we ever refactor ob-python.