Suppressing cmd warning message

328 Views Asked by At

When entering a shell I always get the following warning message from cmd2:

Desktop david$ python3 client.py
Readline features including tab completion have been disabled because
no supported version of readline was found. To resolve this, install
pyreadline on Windows or gnureadline on Mac.

This is something I know, and I'm not looking for or looking to fix that issue. Is there an option to suppress this error message with cmd2 ? By the way, here is where the warning message comes from: https://github.com/python-cmd2/cmd2/blob/f5af7d32fb468012f793eb039e05a86292e0e5bf/cmd2/cmd2.py#L132-L146.

1

There are 1 best solutions below

0
On

Rather than suppressing warnings (not great practice), why not just pip install pyreadline (Windows) or gnureadline (Mac) to fix the issue?

If you insist on suppressing the warning, something like

warnings.filterwarnings("ignore", message="Readline features including tab completion have been disabled")

would likely work.

I highly recommend not suppressing all warnings.