Skip to content

CLI crashes on start if there is no prior .python_history #907

Description

@mgorny

To reproduce:

$ rm ~/.python_history
$ python3.12 -m mpmath --no-ipython
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/usr/lib/python3.12/site-packages/mpmath/__main__.py", line 145, in <module>
    main()
  File "/usr/lib/python3.12/site-packages/mpmath/__main__.py", line 136, in main
    c = MpmathConsole(ast_transformers=ast_transformers,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/mpmath/__main__.py", line 108, in __init__
    readline.read_history_file(history)
FileNotFoundError: [Errno 2] No such file or directory

Hit it with 1.4.0a3 and a2, Python 3.12.8.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions