Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crash on debian bookworm/sid (kernel 5.10.0-8 (5.10.46-4(2021-08-03))) #30

Open
debian-alain opened this issue Sep 2, 2021 · 1 comment

Comments

@debian-alain
Copy link

cpu-g crashes on debian sid (bookworm/sid) .

  1. matplotlib was missing in the prerequisites
    error message :
[Errno 2] No translation file found for domain: 'cpu-g'
Traceback (most recent call last):
  File "/home/alain/Téléchargements/cpu-g/bin/cpu-g", line 41, in <module>
    from cpug import CPUG
  File "/home/alain/Téléchargements/cpu-g/src/cpug.py", line 40, in <module>
    from matplotlib.figure import Figure
ModuleNotFoundError: No module named 'matplotlib'

i had to do this : pip install matplotlib

  1. then /cpu-g/src/distro.py was badly written .
    the error message :
[Errno 2] No translation file found for domain: 'cpu-g'
Traceback (most recent call last):
  File "/home/alain/Téléchargements/cpu-g/bin/cpu-g", line 42, in <module>
    cpug = CPUG()
  File "/home/alain/Téléchargements/cpu-g/src/cpug.py", line 999, in __init__
    self.update_info()
  File "/home/alain/Téléchargements/cpu-g/src/cpug.py", line 1177, in update_info
    self.distribution.set_text(inv.distro())
  File "/home/alain/Téléchargements/cpu-g/src/investigator.py", line 307, in distro
    return get_distro()
  File "/home/alain/Téléchargements/cpu-g/src/distro.py", line 39, in get_distro
    version_split = RELEASE_DATA["VERSION"].split(" ", maxsplit=1)
KeyError: 'VERSION'

here is the file i made (with help) :
you will see the original script and the corrected one :

#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
#
# CPU-G is a program that displays information about your CPU,
# RAM, Motherboard and some general information about your System.
#
# Copyright © 2009  Fotis Tsamis <ftsamis at gmail dot com>.
# Copyright © 2016-2019  Lorenzo Carbonell (aka atareao)
# <lorenzo.carbonell.cerezo at gmail dot com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

import csv

RELEASE_DATA = {}

#def get_distro():
#    with open("/etc/os-release") as f:
#        reader = csv.reader(f, delimiter="=")
#        for row in reader:
#            if row:
#                RELEASE_DATA[row[0]] = row[1]
#
#    if RELEASE_DATA["ID"] in ["debian", "raspbian"]:
#        with open("/etc/debian_version") as f:
#            DEBIAN_VERSION = f.readline().strip()
#        major_version = DEBIAN_VERSION.split(".")[0]
#        version_split = RELEASE_DATA["VERSION"].split(" ", maxsplit=1)
#        if version_split[0] == major_version:
#            # Just major version shown, replace it with the full version
#            RELEASE_DATA["VERSION"] = " ".join([DEBIAN_VERSION] + version_split[1:])
#    return "{} {}".format(RELEASE_DATA["NAME"], RELEASE_DATA.get("VERSION", ""))

def get_distro():
    with open("/etc/os-release") as f:
        reader = csv.reader(f, delimiter="=")
        for row in reader:
            if row:
                RELEASE_DATA[row[0]] = row[1]

    if RELEASE_DATA["ID"] in ["debian", "raspbian"]:
        with open("/etc/debian_version") as f:
            DEBIAN_VERSION = f.readline().strip()
        major_version = DEBIAN_VERSION.split(".")[0]
        try:
            version_split = RELEASE_DATA["VERSION"].split(" ", maxsplit=1)
        except KeyError:
            # VERSION is not set for Debian Sid, fall back on a default value
            version_split = ['12', '(bookworm/sid)']
        if version_split[0] == major_version:
            # Just major version shown, replace it with the full version
            RELEASE_DATA["VERSION"] = " ".join([DEBIAN_VERSION] + version_split[1:])
    return "{} {}".format(RELEASE_DATA["NAME"], RELEASE_DATA.get("VERSION", ""))


if __name__ == '__main__':
    print(get_distro())

my /etc/os-release file :

PRETTY_NAME="Debian GNU/Linux bookworm/sid"
NAME="Debian GNU/Linux"
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

now , the program is nearly good .
still rests the "desktop environment" and the "window manager" wich are not yet recognised .

@WMRamadan
Copy link
Contributor

Applied update to README in pull request #31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants