[dpdk-stable] [PATCH] usertools: fix Python compatibility issue

beilei.xing at intel.com beilei.xing at intel.com
Thu Mar 4 04:07:36 CET 2021


From: Beilei Xing <beilei.xing at intel.com>

For LTS release before 20.02 which should support both Python 2 and 3,
when running usertools/dpdk-devbind.py with Python 2,there'll be the
following error:

Traceback (most recent call last):
  File "usertools/dpdk-devbind.py", line 755, in <module>
    main()
  File "usertools/dpdk-devbind.py", line 743, in main
    check_modules()
  File "usertools/dpdk-devbind.py", line 198, in check_modules
    if module_is_loaded(mod["Name"]):
  File "usertools/dpdk-devbind.py", line 177, in module_is_loaded
    release = platform.uname().release
AttributeError: 'tuple' object has no attribute 'release'

The root cause is that Python 2 doesn't support
platform.uname().release, which is supported by Python 3.

Fixes: 1e794e710d18 ("usertools: fix binding built-in kernel driver")
Cc: stable at dpdk.org

Signed-off-by: Beilei Xing <beilei.xing at intel.com>
---
 usertools/dpdk-devbind.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
index 262a5ff3a9..44ea3dd30b 100755
--- a/usertools/dpdk-devbind.py
+++ b/usertools/dpdk-devbind.py
@@ -174,7 +174,7 @@ def module_is_loaded(module):
     loaded_modules = sysfs_mods
 
     # add built-in modules as loaded
-    release = platform.uname().release
+    release = platform.release()
     filename = os.path.join("/lib/modules/", release, "modules.builtin")
     if os.path.exists(filename):
         try:
-- 
2.26.2



More information about the stable mailing list