I'd like to "log" all of the text (python shell prompts, my commands, python shell output) that displays on my console window after I start the python shell.
I read about powershell's Tee-Object but after running python | tee -filename C:\Path\To\SessionLogfile.txt
in powershell, the only text from the python session that were written out to SessionLogfile.txt
were the outputs of my python commands.
For example, I was expecting to see this in SessionLogfile.txt
:
Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> print("Hello World")
>>> Hello World
quit()
And instead all I see is:
Hello World
It's not important that Tee-Object works. I'm just interested in capturing the session. It's helpful say, when I want to send out to a file the docstring when I issue the python command >>> help(someclass)
.
Start-Transcript