Debugging AttributeError: 'module' object has no attribute 'kmod'
by Christophe Vu-Brugier
Hi Andy,
I am working on better integrating targetcli in Buildroot. Buildroot
is an easy to configure build system that uses cross compilation to
generate tiny root file systems for embedded platforms.
Buildroot supports systemd so I built a root file system with
targetcli and systemd. When systemd is selected as the init system in
Buildroot, the python-kmod module is also built by Buildroot (because
kmod is a dependency of systemd). And since python-kmod is present,
targetcli tries to use it. But it fails with the following error:
# targetcli
Traceback (most recent call last):
File "/usr/bin/targetcli", line 100, in <module>
main()
File "/usr/bin/targetcli", line 63, in main
root_node = UIRoot(shell, as_root=is_root)
File "home/cvubrugier/repos/buildroot/output/x86-targetcli-systemd/target/usr/lib/python3.4/site-packages/targetcli/ui_root.py", line 44, in __init__
File "home/cvubrugier/repos/buildroot/output/x86-targetcli-systemd/target/usr/lib/python3.4/site-packages/rtslib/root.py", line 66, in __init__
File "home/cvubrugier/repos/buildroot/output/x86-targetcli-systemd/target/usr/lib/python3.4/site-packages/rtslib/utils.py", line 364, in modprobe
AttributeError: 'module' object has no attribute 'Kmod'
Trying to use python-kmod by hand also fails on the system.
Python 3.4.1 (default, Oct 29 2014, 13:37:35)
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import kmod
>>> km = kmod.kmod()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'kmod'
Maybe python-kmod is not properly built. Do you have some advises of
what I should look at to debug this issue.
Best regards,
--
Christophe Vu-Brugier
9 years, 5 months