Closed tony closed 11 months ago
I can make a PR over the weekend
@jonathanslenders
Hi! I'm running into this on cloud-based docker images where it's not easy to have a config file. I'm very happy to use the REPL's defaults.
Do you have strong opinions on run_config()
behavior either way? If not, I have two approaches in PRs in the description. They're geared toward making downstream usage frictionless as possible (I think).
Thank you.
@jonathanslenders Any thoughts? Maybe the existing behavior you have is as you intend it to be (that's also fine).
P.S. No hurry either. Just seeing if I can get your attention while the PR is fresh in memory and the issue is ongoing on my side.
Problem / Example
Project: django-extensions's
./manage.py shell_plus
- runs into this if no config is set:This creates friction when launching ptpython:
Other cases
Comments desiring to suppress "Impossible to read": https://github.com/prompt-toolkit/ptpython/issues/329#issuecomment-707014226
I would propose there are others hitting this issue but it hasn't been articulated correctly yet.
Proposal
"Impossible to read" shouldn't print / interrupt loading when the no config file is found
PRs
2 ideas / approaches:
550
551
Relevant code
ptpython.repl.run_config()
ptpython.repl.embed()
Analysis
ptpython.repl.run_config()
has a default argument ofconfig_file: str = "~/.config/ptpython/config.py"
However, in most command line applications, no configuration file exists - there's sensible defaults. e.g.
python
can load without the user having apythonrc
,tmux
can load without a~/.tmux.conf
, etc.The existing behavior means users simply wanting to enter are given an error that's not their fault:
config_file
was entered byptpython
and downstream users that don't have it in place are interrupted.