Giter Club home page Giter Club logo

Comments (4)

wunderwuzzi23 avatar wunderwuzzi23 commented on July 30, 2024 1

Excellent feedback. Thanks so much, made the changes already. Yeah, all my python version were higher ones both on Linux and macOS. On Windows I had an older version, but that didn't matter for this code path.

from yolo-ai-cmdbot.

wunderwuzzi23 avatar wunderwuzzi23 commented on July 30, 2024

from yolo-ai-cmdbot.

mortenmoulder avatar mortenmoulder commented on July 30, 2024

@wunderwuzzi23 It seems like platform.freedesktop_os_release() was removed.. and then added in a newer Python version. What version do you use? I tried on 3.9.2 but got the same error. Updated to 3.11.2 and it works:

>>> import platform
>>> print(platform.freedesktop_os_release())
{'NAME': 'Debian GNU/Linux', 'ID': 'debian', 'PRETTY_NAME': 'Debian GNU/Linux 11 (bullseye)', 'VERSION_ID': '11', 'VERSION': '11 (bullseye)', 'VERSION_CODENAME': 'bullseye', 'HOME_URL': 'https://www.debian.org/', 'SUPPORT_URL': 'https://www.debian.org/support', 'BUG_REPORT_URL': 'https://bugs.debian.org/'}

I see here that people suggest using the distro package instead, but that just returned an empty string with Python 3.9.2:

> python
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> print(platform.freedesktop_os_release())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'platform' has no attribute 'freedesktop_os_release'
>>> import distro
>>> print(distro.like())

>>> print(platform.linux_distribution())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'platform' has no attribute 'linux_distribution'

Same response (apart from platform.freedesktop_os_release()) on 3.11.2. So the suggestion would probably be to update Python to a later version.

Remember that if you update Python, check what version the command python3 uses. To update python3 to use a newer version (like 3.11), after installing the newer version, you can do the following:

update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.11 1

from yolo-ai-cmdbot.

patricksebastien avatar patricksebastien commented on July 30, 2024

How about using distro:
https://pypi.org/project/distro/

import distro
...
  if os_name == "Linux":
      dist_name = distro.name(pretty=True)

It now works... this is a fantastic tool BTW.

from yolo-ai-cmdbot.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.