Skip to content

Crash complaining of tabulate() and preserve_whitespace #1699

Description

@mytskine

Every command crashes with the message tabulate() got an unexpected keyword argument 'preserve_whitespace'.

Here is a session, with added blank lines to increase readability.

❯ mycli -u u -p p --myclirc /usr/lib/python3/dist-packages/mycli/myclirc db
Connecting to socket /var/run/mysqld/mysqld.sock, owned by user mysql
MariaDB 11.8.6
mycli 1.55.0
Home: http://mycli.net
Bug tracker: https://github.com/dbcli/mycli/issues
Tip — customize colors using the "[colors]" section in ~/.myclirc!

MariaDB u@localhost:db> select unix_timestamp('2047-02-01');
tabulate() got an unexpected keyword argument 'preserve_whitespace'

MariaDB mirabel@localhost:mirabel2> show tables;
tabulate() got an unexpected keyword argument 'preserve_whitespace'

MariaDB u@localhost:db> 

System

  • I had just installed mycli with apt (Debian testing).
  • My first session used an old custom myclirc, but nothing changed when I switched to the default config (which the command above uses).
  • Launching with --checkup says everything is alright, except that fzf is not installed.

Activity

  1. rolandwalker commented on Mar 11, 2026

    @rolandwalker
    Contributor

    Hi! Thanks for the report! Seems like dependency versions is something we should add to --checkup.

    If you have the time, could you try these commands?

    env PYTHONPATH= mycli -u u -p p --myclirc /usr/lib/python3/dist-packages/mycli/myclirc db

    (and verify you have the same bug)

    env PYTHONPATH= python -c 'import tabulate; print(tabulate.__version__)'

    (and tell us the tabulate version number)

    env PYTHONPATH= python -c 'import cli_helpers; print(cli_helpers.__version__)'

    (and tell us the cli_helpers version number)

    which tabulate

    (and tell us if there is any output at all)

    The guess would be that Debian installs a different version of tabulate that our software expects. tabulate recently made a release with a breaking change. Perhaps we should do some version probing as was initially suggested in dbcli/cli_helpers#107.

  2. schnapster commented on Mar 20, 2026

    @schnapster

    I have the same issue unfortunately, here is some of the requested debug output.

    env PYTHONPATH= python3 -c 'import tabulate; print(tabulate.__version__)'      
    0.9.0
    
    env PYTHONPATH= python3 -c 'import cli_helpers; print(cli_helpers.__version__)'
    2.11.0
    
    which tabulate
    /usr/bin/tabulate
    

    The problem is the same when using --myclirc /usr/lib/python3/dist-packages/mycli/myclirc

  3. rolandwalker commented on Mar 20, 2026

    @rolandwalker
    Contributor

    @schnapster many thanks! That's strange because those are the two latest versions of cli_helpers and tabulate. But I will look into this tomorrow, and try to replicate.

    Edit: the above is incorrect. 0.9.0 is not the latest version of tabulate.

  4. rolandwalker commented on Mar 21, 2026

    @rolandwalker
    Contributor
  5. schnapster commented on Mar 23, 2026

    @schnapster

    Apologies, I should have checked the mycli version. This morning, v1.64 was installed over 1.62, and the problem is gone. It may have already been solved in the current codebase 😬

  6. schnapster commented on Mar 23, 2026

    @schnapster

    Nvm I got too excited there, its still broken for me when running a query (but connection works).

    I downloaded 1.66 from Debian Sid repo, and heres the dependency output of --checkup:

    ### Key Python dependencies:
    
    cli_helpers version 2.11.0 (latest 2.12.0)
    click version 8.1.8 (latest 8.3.1)
    prompt_toolkit version 3.0.52 (latest 3.0.52)
    pymysql version 1.1.1 (latest 1.1.2)
    tabulate version 0.9.0 (latest 0.10.0)
    

    cli_helpers 2.12 is not available on debian sid yet it seems

  7. rolandwalker commented on Mar 23, 2026

    @rolandwalker
    Contributor

    Yes, the fix depends on the newest cli_helpers, or a newer tabulate.

  8. schnapster commented on Mar 23, 2026

    @schnapster

    My workaround for now:

    edited /usr/lib/python3/dist-packages/cli_helpers/tabular_output/tabulate_adapter.py:

    -     tkwargs.update(preserve_whitespace=preserve_whitespace)
    +     tkwargs.update()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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