# Buggy code
def process_inet(self, file, family, type_, inodes, filter_pid=None):
    """Parse /proc/net/tcp* and /proc/net/udp* files."""
    if file.endswith("6") and not os.path.exists(file):
        # IPv6 not supported
        return
    with open_text(file, buffering=BIGGER_FILE_BUFFERING) as f:
        f.readline()  # skip the first line
        for line in f:
            try:
                _, laddr, raddr, status, _, _, _, _, _, inode = line.split()[:10]
            except ValueError:
                raise RuntimeError(
                    "error while parsing %s; malformed line %r" % (file, line)
                )
            if inode in inodes:
                # # We assume inet sockets are unique, so we error
                # # out if there are multiple references to the
                # # same inode. We won't do this for UNIX sockets.
                # if len(inodes[inode]) > 1 and family != socket.AF_UNIX:
                #     raise ValueError("ambiguos inode with multiple "
                #                      "PIDs references")
                pid, fd = inodes[inode][0]
            else:
                pid, fd = None, -1
            if filter_pid is not None and filter_pid != pid:
                continue
            else:
                if type_ == socket.SOCK_STREAM:
                    status = TCP_STATUSES[status]
                else:
                    status = _common.CONN_NONE
                try:
                    laddr = self.decode_address(laddr, family)
                    raddr = self.decode_address(raddr, family)
                except _Ipv6UnsupportedError:
                    continue
                yield (fd, family, type_, laddr, raddr, status, pid)


# Traceback (ValueError)
Could not find neovim socket error while parsing /proc/net/unix; malformed line '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\n'
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/psutil-3.2.0-py3.4-linux-x86_64.egg/psutil/_pslinux.py", line 525, in process_unix
_, _, _, _, type_, _, inode = tokens[0:7]
ValueError: need more than 1 value to unpack

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/teto/.i3/i3dispatch.py", line 115, in get_nvim_socket
unix_sockets = child.connections(kind="unix")
File "/usr/local/lib/python3.4/dist-packages/psutil-3.2.0-py3.4-linux-x86_64.egg/psutil/__init__.py", line 1010, in connections
return self._proc.connections(kind)
File "/usr/local/lib/python3.4/dist-packages/psutil-3.2.0-py3.4-linux-x86_64.egg/psutil/_pslinux.py", line 722, in wrapper
return fun(self, *args, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/psutil-3.2.0-py3.4-linux-x86_64.egg/psutil/_pslinux.py", line 1178, in connections
ret = _connections.retrieve(kind, self.pid)
File "/usr/local/lib/python3.4/dist-packages/psutil-3.2.0-py3.4-linux-x86_64.egg/psutil/_pslinux.py", line 568, in retrieve
for fd, family, type_, laddr, raddr, status, bound_pid in ls:
File "/usr/local/lib/python3.4/dist-packages/psutil-3.2.0-py3.4-linux-x86_64.egg/psutil/_pslinux.py", line 529, in process_unix
file, line))
RuntimeError: error while parsing /proc/net/unix; malformed line '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\n'

# Fixed code
def process_inet(self, file, family, type_, inodes, filter_pid=None):
    """Parse /proc/net/tcp* and /proc/net/udp* files."""
    if file.endswith("6") and not os.path.exists(file):
        # IPv6 not supported
        return
    with open_text(file, buffering=BIGGER_FILE_BUFFERING) as f:
        f.readline()  # skip the first line
        for lineno, line in enumerate(f, 1):
            try:
                _, laddr, raddr, status, _, _, _, _, _, inode = line.split()[:10]
            except ValueError:
                raise RuntimeError(
                    "error while parsing %s; malformed line %s %r"
                    % (file, lineno, line)
                )
            if inode in inodes:
                # # We assume inet sockets are unique, so we error
                # # out if there are multiple references to the
                # # same inode. We won't do this for UNIX sockets.
                # if len(inodes[inode]) > 1 and family != socket.AF_UNIX:
                #     raise ValueError("ambiguos inode with multiple "
                #                      "PIDs references")
                pid, fd = inodes[inode][0]
            else:
                pid, fd = None, -1
            if filter_pid is not None and filter_pid != pid:
                continue
            else:
                if type_ == socket.SOCK_STREAM:
                    status = TCP_STATUSES[status]
                else:
                    status = _common.CONN_NONE
                try:
                    laddr = self.decode_address(laddr, family)
                    raddr = self.decode_address(raddr, family)
                except _Ipv6UnsupportedError:
                    continue
                yield (fd, family, type_, laddr, raddr, status, pid)