0

I am using PTPython to interactively debug my app. When embedding PTPython in my app, how do I support reading the PTPthon config file?

According to the example PTPython config file, in Linux the PTPython config file should be located at the path ~/.config/ptpython/config.py

I'm embedding PTPython using the following:

from ptpython.repl import embed
embed(globals(), locals(), vi_mode=False)
JS.
  • 14,781
  • 13
  • 63
  • 75

1 Answers1

0

Based on this example, I've found the following will read my PTPython config file:

from ptpython.repl import embed, run_config

def configure(repl):
    config_path = pathlib.Path("/home/me/.config/ptpython/config.py")
    run_config(repl, config_path)

history_path = pathlib.Path("/home/me/.ptpython/history")
embed(globals(), locals(), vi_mode=False, configure=configure, history_filename=history_path)
JS.
  • 14,781
  • 13
  • 63
  • 75