Skip to content
Advertisement

How to read history in ptpython console?

I’ve been trying to figure out how to get save and read in the history of my Python commands in a ptpython console, but haven’t been able to do so. All of my efforts have so far been variations of this answer. However, I still am not able to read in my history.

I would simply like to be able to press the and arrows to go through my Python commands from a previous console session (not the current console session that I’m in). Here’s what I currently have in my $PYTHONSTARTUP file:

JavaScript

And my $PYTHONSTARTUP variable is:

JavaScript

I’m on Python 3.7.3, macOS 10.14.6, and ptpython 2.0.4.

Thanks

Advertisement

Answer

If you check source code for embed then you see option history_filename=

JavaScript

JavaScript

BTW: If folder ~/.ptpython doesn’t exists then you will have to create it before run code.

EDIT (2022):

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement