Skip to content

ptpython.run_config() / embed() "Impossible to read" interrupt with default usage #549

@tony

Description

@tony

Problem / Example

Project: django-extensions's ./manage.py shell_plus - runs into this if no config is set:

./manage.py shell_plus
<loading django imports>
Impossible to read '/Users/<username>/.config/ptpython/config.py'

This creates friction when launching ptpython:

  • Users are accustomed to default behavior when launching apps, absent explicit action on their part.
  • Cloud environments and ephemeral systems can't easily control that file - I propose it's more common than just I - are interrupted by an error.

Other cases

Comments desiring to suppress "Impossible to read": #329 (comment)

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:

Relevant code

ptpython.repl.run_config()

ptpython.repl.embed()

Analysis

ptpython.repl.run_config() has a default argument of config_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 a pythonrc, 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 by ptpython and downstream users that don't have it in place are interrupted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions