Skip to content

"Unable to init server" warning with GTK import #5251

Open
@mgrabovsky

Description

@mgrabovsky

Bug description

When running Pylint on code which imports any GTK or GDK stuff via the GObject mechanism, the warning Unable to init server: Could not connect: Connection refused is printed out.

Here's a complete reproducer (running in a fresh Fedora 35 container):

# dnf install --refresh -y python3-pylint python3-gobject pygobject3-devel gtk3-devel
# cd /tmp ; cat > test.py <<EOF
import sys
print(len(sys.argv))
EOF

test.py is a simple Python script with no complicated logic. Pylint goes through it just fine:

# pylint-3 -d C0114,W0611 test.py

------------------------------------
Your code has been rated at 10.00/10

Now let's add the GTK import and see what happens:

# sed -ie '1a import gi.repository.Gtk' test.py
# pylint-3 -d C0114,W0611 test.py
Unable to init server: Could not connect: Connection refused
Unable to init server: Could not connect: Connection refused

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

Via some magical mechanism, this also causes our Pylint pipeline to time out, see, for example, this recent run.

I've found a related bug, #2649, but its outcome is not satisfactory.

Expected behavior

I would expect Pylint to lint the file without emitting any unrelated warnings and not to time out when being run as part of a GitHub workflow.

Pylint version

pylint 2.11.1
astroid 2.8.4
Python 3.10.0 (default, Oct  5 2021, 00:00:00) [GCC 11.2.1 20210728 (Red Hat 11.2.1-1)]

OS / Environment

Fedora 35 (inside a container)

Additional dependencies

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions