SyntaxWarning when importing tabulate using python3.8

Bug #1911002 reported by Thomas Cellerier
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
python-tabulate (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

The python3-tabulate package raises a SyntaxWarning when imported using python3.8.

To work around this I use the following code for an internal CLI application:

    import warnings
    with warnings.catch_warnings():
        # Ignore the following warning when importing the tabulate package:
        # /usr/lib/python3/dist-packages/tabulate.py:196: SyntaxWarning: "is" with a literal. Did you mean "=="?
        # if isinstance(val, (_text_type, _binary_type)) and val.strip() is "":
        warnings.simplefilter("ignore")
        from tabulate import tabulate

$ lsb_release -rd
Description: Ubuntu 18.04.5 LTS
Release: 18.04

$ sudo apt install python3-tabulate
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  python3-tabulate
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 28,9 kB of archives.
After this operation, 127 kB of additional disk space will be used.
Get:1 http://se.archive.ubuntu.com/ubuntu bionic/universe amd64 python3-tabulate all 0.7.7-1 [28,9 kB]
Fetched 28,9 kB in 0s (90,5 kB/s)
Selecting previously unselected package python3-tabulate.
(Reading database ... 314447 files and directories currently installed.)
Preparing to unpack .../python3-tabulate_0.7.7-1_all.deb ...
Unpacking python3-tabulate (0.7.7-1) ...
Setting up python3-tabulate (0.7.7-1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...

$python3.8
Python 3.8.7 (default, Dec 21 2020, 20:10:35)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tabulate
/usr/lib/python3/dist-packages/tabulate.py:196: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if isinstance(val, (_text_type, _binary_type)) and val.strip() is "":
>>>

$ which python3.8
/usr/bin/python3.8
$ dpkg --list|grep python3.8
ii libpython3.8:amd64 3.8.7-1+bionic1 amd64 Shared Python runtime library (version 3.8)
ii libpython3.8-dev:amd64 3.8.7-1+bionic1 amd64 Header files and a static library for Python (v3.8)
ii libpython3.8-minimal:amd64 3.8.7-1+bionic1 amd64 Minimal subset of the Python language (version 3.8)
ii libpython3.8-stdlib:amd64 3.8.7-1+bionic1 amd64 Interactive high-level object-oriented language (standard library, version 3.8)
ii python3.8 3.8.7-1+bionic1 amd64 Interactive high-level object-oriented language (version 3.8)
ii python3.8-dev 3.8.7-1+bionic1 amd64 Header files and a static library for Python (v3.8)
ii python3.8-minimal 3.8.7-1+bionic1 amd64 Minimal subset of the Python language (version 3.8)
ii python3.8-venv 3.8.7-1+bionic1 amd64 Interactive high-level object-oriented language (pyvenv binary, version 3.8)

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in python-tabulate (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.