Skip to content

pyroute2 import fails if kernel local version does not start with a dash #885

Closed
@fabi125

Description

@fabi125

12a1aa8 changed how the kernel version gets parsed which seems to be a lot less lenient when it comes to parsing the version string.

trying to import pyroute2 0.6.7 on a host that is running a kernel with a version like 5.15.15.debug causes an exception:

$ uname -r
5.15.15.debug
$ pip show pyroute2
Name: pyroute2
Version: 0.6.7
Summary: Python Netlink library
Home-page: https://github.com/svinota/pyroute2
Author: 
Author-email: 
License: dual license GPLv2+ and Apache v2
Location: /home/fabi/pyroute2-env/lib/python3.8/site-packages
Requires: pyroute2.core, pyroute2.ethtool, pyroute2.ipdb, pyroute2.ipset, pyroute2.ndb, pyroute2.nftables, pyroute2.nslink
Required-by: 
$ python -c 'import pyroute2'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/fabi/pyroute2-env/lib/python3.8/site-packages/pyroute2/__init__.py", line 14, in <module>
    from pr2modules.config.version import __version__
  File "/home/fabi/pyroute2-env/lib/python3.8/site-packages/pr2modules/config/__init__.py", line 25, in <module>
    kernel = [int(x) for x in uname[2].split('-')[0].split('.')]
  File "/home/fabi/pyroute2-env/lib/python3.8/site-packages/pr2modules/config/__init__.py", line 25, in <listcomp>
    kernel = [int(x) for x in uname[2].split('-')[0].split('.')]
ValueError: invalid literal for int() with base 10: 'debug'

Other people seem to run into the issues as well. e.g. https://bugs.launchpad.net/neutron/+bug/1961906

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions