* Re: Debugging AttributeError: 'module' object has no attribute 'kmod' [not found] ` <20141030173744.681f77df@PAL-U515208D001> @ 2014-10-30 18:36 ` Andy Grover 2014-11-15 13:34 ` Lucas De Marchi 0 siblings, 1 reply; 3+ messages in thread From: Andy Grover @ 2014-10-30 18:36 UTC (permalink / raw) To: Christophe Vu-Brugier; +Cc: targetcli-fb-devel, linux-modules On 10/30/2014 09:37 AM, Christophe Vu-Brugier wrote: > Hi Andy, > > On Thu, 30 Oct 2014 09:24:37 -0700, Andy Grover wrote : >> On 10/30/2014 08:09 AM, Christophe Vu-Brugier wrote: >>> 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. >> >> Can you supply the kmod/python-kmod version information? > > This is the latest version of kmod: > > # kmod --version > kmod version 18 (CCing kmod dev list too) Starting in kmod v17 the Python library was merged into the main kmod repo, and the version indicates that you are using the Python wrapper built from that (as opposed to the now-defunct separate project called python-kmod, whose versions never exceeded 0.9.) Lucas De Marchi did the build integration because my autotools knowledge was not sufficient -- I suspect building kmod with --enable-python only enables Python 2. I'd need to know more about what distro you're on and look at the packaging scripts, but I think upstream support for building the library for Python 3 is needed (this might be extremely simple but it still probably requires a separate --enable-python3 configure option). Did the packager think they could just take the Py2 binaries and they'd work for Python 3??? So I'd open an issue with the kmod packager for whatever distro because something is broken, and maybe the CC'd upstream developers might also be able to help us have explicit support for building for Python 3? Thanks -- Regards -- Andy ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Debugging AttributeError: 'module' object has no attribute 'kmod' 2014-10-30 18:36 ` Debugging AttributeError: 'module' object has no attribute 'kmod' Andy Grover @ 2014-11-15 13:34 ` Lucas De Marchi 2014-11-15 20:59 ` Christophe Vu-Brugier 0 siblings, 1 reply; 3+ messages in thread From: Lucas De Marchi @ 2014-11-15 13:34 UTC (permalink / raw) To: Andy Grover; +Cc: Christophe Vu-Brugier, targetcli-fb-devel, linux-modules Hi, sorry for the delay On Thu, Oct 30, 2014 at 4:36 PM, Andy Grover <agrover@redhat.com> wrote: > On 10/30/2014 09:37 AM, Christophe Vu-Brugier wrote: >> >> Hi Andy, >> >> On Thu, 30 Oct 2014 09:24:37 -0700, Andy Grover wrote : >>> >>> On 10/30/2014 08:09 AM, Christophe Vu-Brugier wrote: >>>> >>>> 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() it should be kmod.Kmod() Note the capital K. > (CCing kmod dev list too) > > Starting in kmod v17 the Python library was merged into the main kmod repo, > and the version indicates that you are using the Python wrapper built from > that (as opposed to the now-defunct separate project called python-kmod, > whose versions never exceeded 0.9.) > > Lucas De Marchi did the build integration because my autotools knowledge was > not sufficient -- I suspect building kmod with --enable-python only enables > Python 2. I'd need to know more about what distro you're on and look at the > packaging scripts, but I think upstream support for building the library for > Python 3 is needed (this might be extremely simple but it still probably > requires a separate --enable-python3 configure option). Did the packager > think they could just take the Py2 binaries and they'd work for Python 3??? > > So I'd open an issue with the kmod packager for whatever distro because > something is broken, and maybe the CC'd upstream developers might also be > able to help us have explicit support for building for Python 3? It should work fine with python3 as well. Just tested here: $ make install DESTDIR=/tmp/inst $ PYTHONPATH=/tmp/inst/usr/lib/python3.4/site-packages python3 Python 3.4.2 (default, Oct 8 2014, 13:44:52) [GCC 4.9.1 20140903 (prerelease)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import kmod >>> km = kmod.Kmod() >>> km.loaded() <generator object at 0x7fbf9f807cc8> -- Lucas De Marchi ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Debugging AttributeError: 'module' object has no attribute 'kmod' 2014-11-15 13:34 ` Lucas De Marchi @ 2014-11-15 20:59 ` Christophe Vu-Brugier 0 siblings, 0 replies; 3+ messages in thread From: Christophe Vu-Brugier @ 2014-11-15 20:59 UTC (permalink / raw) To: Lucas De Marchi; +Cc: Andy Grover, targetcli-fb-devel, linux-modules Hi, On Sat, 15 Nov 2014 11:34:56 -0200, Lucas De Marchi wrote : > >>>> 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() > > it should be kmod.Kmod() > > Note the capital K. Yes. I tested kmod with Python 3 outside of Buildroot and it works fine. However, with Buildroot there is a problem because Buildroot generates a Python 3 installation that does not follow PEP 3147 "PYC Repository Directories". This means that *.py[co] files are not installed in __pycache__ directories and this makes python-kmod fail. But this is problem with Buildroot's Python 3 installation. There is no issue with Kmod here. Thanks! > > (CCing kmod dev list too) > > > > Starting in kmod v17 the Python library was merged into the main > > kmod repo, and the version indicates that you are using the Python > > wrapper built from that (as opposed to the now-defunct separate > > project called python-kmod, whose versions never exceeded 0.9.) > > > > Lucas De Marchi did the build integration because my autotools > > knowledge was not sufficient -- I suspect building kmod with > > --enable-python only enables Python 2. I'd need to know more about > > what distro you're on and look at the packaging scripts, but I > > think upstream support for building the library for Python 3 is > > needed (this might be extremely simple but it still probably > > requires a separate --enable-python3 configure option). Did the > > packager think they could just take the Py2 binaries and they'd > > work for Python 3??? > > > > So I'd open an issue with the kmod packager for whatever distro > > because something is broken, and maybe the CC'd upstream developers > > might also be able to help us have explicit support for building > > for Python 3? > > It should work fine with python3 as well. Just tested here: > > $ make install DESTDIR=/tmp/inst > $ PYTHONPATH=/tmp/inst/usr/lib/python3.4/site-packages python3 > Python 3.4.2 (default, Oct 8 2014, 13:44:52) > [GCC 4.9.1 20140903 (prerelease)] on linux > Type "help", "copyright", "credits" or "license" for more information. > >>> import kmod > >>> km = kmod.Kmod() > >>> km.loaded() > <generator object at 0x7fbf9f807cc8> > -- Christophe Vu-Brugier ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-11-15 20:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20141030160932.15107fde@PAL-U515208D001>
[not found] ` <54526645.2010008@redhat.com>
[not found] ` <20141030173744.681f77df@PAL-U515208D001>
2014-10-30 18:36 ` Debugging AttributeError: 'module' object has no attribute 'kmod' Andy Grover
2014-11-15 13:34 ` Lucas De Marchi
2014-11-15 20:59 ` Christophe Vu-Brugier
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).