系統 - Debian - 解決Cannot get content of gir1.2-ibus-1.0問題



參考資訊:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=770265

問題如下:

Setting up gir1.2-ibus-1.0:amd64 (1.5.14-3) ...
dpkg-query: error: --listfiles needs a valid package name but 'gir1.2-ibus-1.0' is not: ambiguous package name 'gir1.2-ibus-1.0' with more than one installed instance

Use --help for help about querying packages.
Traceback (most recent call last):
    File "/usr/bin/py3compile", line 290, in 
        main()
    File "/usr/bin/py3compile", line 270, in main
        options.force, options.optimize, e_patterns)
    File "/usr/bin/py3compile", line 154, in compile
        for fn, versions_to_compile in filter_files(files, e_patterns, versions):
    File "/usr/bin/py3compile", line 106, in filter_files
        for fn in files:
    File "/usr/share/python3/debpython/files.py", line 71, in filter_public
        for fn in files:
    File "/usr/share/python3/debpython/files.py", line 53, in from_package
        raise Exception("cannot get content of %s" % package_name)

Exception: cannot get content of gir1.2-ibus-1.0
dpkg: error processing package gir1.2-ibus-1.0:amd64 (--configure):
    subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
    gir1.2-ibus-1.0:amd64
E: Sub-process /usr/bin/dpkg returned an error code (1)

解法如下:

$ sudo vim /usr/share/python3/debpython/files.py +53
    #if process.returncode != 0:
        #raise Exception("cannot get content of %s" % package_name)

$ sudo apt-get remove --purge gir1.2-ibus-1.0*
$ sudo vim /usr/share/python3/debpython/files.py +53
    if process.returncode != 0:
        raise Exception("cannot get content of %s" % package_name)