All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [announce] python-kmod 0.9
       [not found] <509C4944.3040907@redhat.com>
@ 2013-11-11 19:28 ` Lucas De Marchi
  2013-11-11 19:40   ` Andy Grover
  0 siblings, 1 reply; 11+ messages in thread
From: Lucas De Marchi @ 2013-11-11 19:28 UTC (permalink / raw)
  To: Andy Grover; +Cc: linux-modules, wking

On Thu, Nov 8, 2012 at 10:07 PM, Andy Grover <agrover@redhat.com> wrote:
> Hi all,
>
> I'd like to announce python-kmod 0.9. It is available here:
>
> https://github.com/agrover/python-kmod
> git://github.com/agrover/python-kmod.git
> https://github.com/downloads/agrover/python-kmod/python-kmod-0.9.tar.gz
>
> A gentleman named W. Trevor King basically rewrote it from the ground up
> using Cython, a language that bridges the gap between C and Python.
> These changes make python-kmod Python 3 compatible, as well as enabling
> the Python API to fully express libkmod's featureset.
>
> Anyways, this was a big change, so I wanted to announce it. :)
>
> Regards -- Andy
>
> p.s. btw I've worked on some other libs where core devs wanted to pull
> in Python bindings to their tree. Not asking for this, but not opposed,
> if desired. :) -a

Hey. I think I replied once that this could be better left off in its
own repository. However I'm reconsidering this now... if you are still
interested in merging into kmod, I think it would be good.


Regards,

Lucas De Marchi

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [announce] python-kmod 0.9
  2013-11-11 19:28 ` [announce] python-kmod 0.9 Lucas De Marchi
@ 2013-11-11 19:40   ` Andy Grover
  2013-12-18 19:38     ` Lucas De Marchi
  0 siblings, 1 reply; 11+ messages in thread
From: Andy Grover @ 2013-11-11 19:40 UTC (permalink / raw)
  To: Lucas De Marchi; +Cc: linux-modules, wking

On 11/11/2013 11:28 AM, Lucas De Marchi wrote:
> On Thu, Nov 8, 2012 at 10:07 PM, Andy Grover <agrover@redhat.com> wrote:
>> Hi all,
>>
>> I'd like to announce python-kmod 0.9. It is available here:

>> p.s. btw I've worked on some other libs where core devs wanted to pull
>> in Python bindings to their tree. Not asking for this, but not opposed,
>> if desired. :) -a
>
> Hey. I think I replied once that this could be better left off in its
> own repository. However I'm reconsidering this now... if you are still
> interested in merging into kmod, I think it would be good.

You bet. I'll start work on a patch.

Regards -- Andy


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [announce] python-kmod 0.9
  2013-11-11 19:40   ` Andy Grover
@ 2013-12-18 19:38     ` Lucas De Marchi
  2013-12-19  1:20       ` Andy Grover
  0 siblings, 1 reply; 11+ messages in thread
From: Lucas De Marchi @ 2013-12-18 19:38 UTC (permalink / raw)
  To: Andy Grover; +Cc: Lucas De Marchi, linux-modules, wking

Hi Andy,

On Mon, Nov 11, 2013 at 5:40 PM, Andy Grover <agrover@redhat.com> wrote:
>
> On 11/11/2013 11:28 AM, Lucas De Marchi wrote:
>>
>> On Thu, Nov 8, 2012 at 10:07 PM, Andy Grover <agrover@redhat.com> wrote:
>>>
>>> Hi all,
>>>
>>> I'd like to announce python-kmod 0.9. It is available here:
>
>
>>> p.s. btw I've worked on some other libs where core devs wanted to pull
>>> in Python bindings to their tree. Not asking for this, but not opposed,
>>> if desired. :) -a
>>
>>
>> Hey. I think I replied once that this could be better left off in its
>> own repository. However I'm reconsidering this now... if you are still
>> interested in merging into kmod, I think it would be good.
>
>
> You bet. I'll start work on a patch.

Ping.

Lucas De Marchi

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [announce] python-kmod 0.9
  2013-12-18 19:38     ` Lucas De Marchi
@ 2013-12-19  1:20       ` Andy Grover
  2013-12-22 21:52         ` Lucas De Marchi
  0 siblings, 1 reply; 11+ messages in thread
From: Andy Grover @ 2013-12-19  1:20 UTC (permalink / raw)
  To: Lucas De Marchi; +Cc: Lucas De Marchi, linux-modules, wking

On 12/18/2013 11:38 AM, Lucas De Marchi wrote:
>>> Hey. I think I replied once that this could be better left off in its
>>> own repository. However I'm reconsidering this now... if you are still
>>> interested in merging into kmod, I think it would be good.
>>
>>
>> You bet. I'll start work on a patch.
>
> Ping.

Hi Lucas,

Sorry for the delay. Here's what I have so far:

https://github.com/agrover/kmod.git

Copied source in, modified configure.ac. But I'm pretty weak on 
automake. Basically the Python bindings need "python setup.py build" and 
"python setup.py install" for the relevant make targets, but that still 
needs to be hooked up :-/

Would you or some other kind soul that knows automake be willing to 
advise, or even fix this up the rest of the way?

Thanks -- Regards -- Andy

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [announce] python-kmod 0.9
  2013-12-19  1:20       ` Andy Grover
@ 2013-12-22 21:52         ` Lucas De Marchi
  2014-03-24 12:02           ` Lucas De Marchi
  0 siblings, 1 reply; 11+ messages in thread
From: Lucas De Marchi @ 2013-12-22 21:52 UTC (permalink / raw)
  To: Andy Grover; +Cc: Lucas De Marchi, linux-modules, wking

Hi Andy,

On Wed, Dec 18, 2013 at 11:20 PM, Andy Grover <agrover@redhat.com> wrote:
> On 12/18/2013 11:38 AM, Lucas De Marchi wrote:
>>>>
>>>> Hey. I think I replied once that this could be better left off in its
>>>> own repository. However I'm reconsidering this now... if you are still
>>>> interested in merging into kmod, I think it would be good.
>>>
>>>
>>>
>>> You bet. I'll start work on a patch.
>>
>>
>> Ping.
>
>
> Hi Lucas,
>
> Sorry for the delay. Here's what I have so far:
>
> https://github.com/agrover/kmod.git
>
> Copied source in, modified configure.ac. But I'm pretty weak on automake.
> Basically the Python bindings need "python setup.py build" and "python
> setup.py install" for the relevant make targets, but that still needs to be
> hooked up :-/
>
> Would you or some other kind soul that knows automake be willing to advise,
> or even fix this up the rest of the way?

Sure  I'll do the missing glue to the build system.

>
> Thanks -- Regards -- Andy

I decided to let this out of kmod 16 so we have more time to play with
the python bindings...


regards,
Lucas De Marchi

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [announce] python-kmod 0.9
  2013-12-22 21:52         ` Lucas De Marchi
@ 2014-03-24 12:02           ` Lucas De Marchi
  2014-03-24 17:12             ` Andy Grover
  0 siblings, 1 reply; 11+ messages in thread
From: Lucas De Marchi @ 2014-03-24 12:02 UTC (permalink / raw)
  To: Andy Grover; +Cc: Lucas De Marchi, linux-modules, W. Trevor King

Hi Andy,

On Sun, Dec 22, 2013 at 7:52 PM, Lucas De Marchi
<lucas.de.marchi@gmail.com> wrote:
> Hi Andy,
>
> On Wed, Dec 18, 2013 at 11:20 PM, Andy Grover <agrover@redhat.com> wrote:
>> On 12/18/2013 11:38 AM, Lucas De Marchi wrote:
>>>>>
>>>>> Hey. I think I replied once that this could be better left off in its
>>>>> own repository. However I'm reconsidering this now... if you are still
>>>>> interested in merging into kmod, I think it would be good.
>>>>
>>>>
>>>>
>>>> You bet. I'll start work on a patch.
>>>
>>>
>>> Ping.
>>
>>
>> Hi Lucas,
>>
>> Sorry for the delay. Here's what I have so far:
>>
>> https://github.com/agrover/kmod.git
>>
>> Copied source in, modified configure.ac. But I'm pretty weak on automake.
>> Basically the Python bindings need "python setup.py build" and "python
>> setup.py install" for the relevant make targets, but that still needs to be
>> hooked up :-/
>>
>> Would you or some other kind soul that knows automake be willing to advise,
>> or even fix this up the rest of the way?
>
> Sure  I'll do the missing glue to the build system.

I've just pushed a branch named "python" which contains the python
bindings. I did it a bit different than you:

 - All the code from your repository was imported maintaining the
history. I would like to keep it, so I did a merge of the final import
(fast forward, but forced to contain a commit).
 - Python bindings are built with autotools. This allows to easily
express the dependency with libkmod... but I'm not sure this is ideal
as opposed to having a target to explicitely calling setuptools.  Any
opinion?

Then I noticed the example given in the README file doesn't work.
Neither by installing they original python-kmod package :-/

    >>> import kmod
    >>> km = kmod.Kmod()
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    AttributeError: 'module' object has no attribute 'Kmod'
    >>> dir(kmod)
    ['__builtins__', '__doc__', '__file__', '__loader__', '__name__',
'__package__', '__path__', '__version__', 'list', 'version']


--
Lucas De Marchi

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [announce] python-kmod 0.9
  2014-03-24 12:02           ` Lucas De Marchi
@ 2014-03-24 17:12             ` Andy Grover
  2014-03-26 17:45               ` Lucas De Marchi
  0 siblings, 1 reply; 11+ messages in thread
From: Andy Grover @ 2014-03-24 17:12 UTC (permalink / raw)
  To: Lucas De Marchi; +Cc: Lucas De Marchi, linux-modules, W. Trevor King

On 03/24/2014 05:02 AM, Lucas De Marchi wrote:
> I've just pushed a branch named "python" which contains the python
> bindings. I did it a bit different than you:
>
>   - All the code from your repository was imported maintaining the
> history. I would like to keep it, so I did a merge of the final import
> (fast forward, but forced to contain a commit).
>   - Python bindings are built with autotools. This allows to easily
> express the dependency with libkmod... but I'm not sure this is ideal
> as opposed to having a target to explicitely calling setuptools.  Any
> opinion?
>
> Then I noticed the example given in the README file doesn't work.
> Neither by installing they original python-kmod package :-/
>
>      >>> import kmod
>      >>> km = kmod.Kmod()
>      Traceback (most recent call last):
>        File "<stdin>", line 1, in <module>
>      AttributeError: 'module' object has no attribute 'Kmod'
>      >>> dir(kmod)
>      ['__builtins__', '__doc__', '__file__', '__loader__', '__name__',
> '__package__', '__path__', '__version__', 'list', 'version']
>

The old 'python-kmod' pkg works for me:

[agrover@work ~/.../python/kmod ((fac4d09...))]$ ipython

In [1]: import kmod

In [2]: km = kmod.Kmod()

In [3]: sc = list(km.lookup("soundcore"))[0]

In [4]: sc.path
Out[4]: u'/lib/modules/3.13.6-200.fc20.x86_64/kernel/sound/soundcore.ko'

but when I try to use the new stuff:

[agrover@work ~/.../python/kmod ((fac4d09...))]$ 
PYTHONPATH="/home/agrover/git/kmod/libkmod/python/kmod/.libs" ipython

In [1]: import kmod
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-ff824b795612> in <module>()
----> 1 import kmod

ImportError: dynamic module does not define init function (initkmod)

Is this what you're seeing as well?

Regards -- Andy

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [announce] python-kmod 0.9
  2014-03-24 17:12             ` Andy Grover
@ 2014-03-26 17:45               ` Lucas De Marchi
  2014-03-26 20:32                 ` Andy Grover
  0 siblings, 1 reply; 11+ messages in thread
From: Lucas De Marchi @ 2014-03-26 17:45 UTC (permalink / raw)
  To: Andy Grover
  Cc: Lucas De Marchi, Lucas De Marchi, linux-modules, W. Trevor King

On Mon, Mar 24, 2014 at 10:12:26AM -0700, Andy Grover wrote:
> On 03/24/2014 05:02 AM, Lucas De Marchi wrote:
> >I've just pushed a branch named "python" which contains the python
> >bindings. I did it a bit different than you:
> >
> >  - All the code from your repository was imported maintaining the
> >history. I would like to keep it, so I did a merge of the final import
> >(fast forward, but forced to contain a commit).
> >  - Python bindings are built with autotools. This allows to easily
> >express the dependency with libkmod... but I'm not sure this is ideal
> >as opposed to having a target to explicitely calling setuptools.  Any
> >opinion?
> >
> >Then I noticed the example given in the README file doesn't work.
> >Neither by installing they original python-kmod package :-/
> >
> >     >>> import kmod
> >     >>> km = kmod.Kmod()
> >     Traceback (most recent call last):
> >       File "<stdin>", line 1, in <module>
> >     AttributeError: 'module' object has no attribute 'Kmod'
> >     >>> dir(kmod)
> >     ['__builtins__', '__doc__', '__file__', '__loader__', '__name__',
> >'__package__', '__path__', '__version__', 'list', 'version']
> >
> 
> The old 'python-kmod' pkg works for me:
> 
> [agrover@work ~/.../python/kmod ((fac4d09...))]$ ipython
> 
> In [1]: import kmod
> 
> In [2]: km = kmod.Kmod()
> 
> In [3]: sc = list(km.lookup("soundcore"))[0]
> 
> In [4]: sc.path
> Out[4]: u'/lib/modules/3.13.6-200.fc20.x86_64/kernel/sound/soundcore.ko'
> 
> but when I try to use the new stuff:
> 
> [agrover@work ~/.../python/kmod ((fac4d09...))]$
> PYTHONPATH="/home/agrover/git/kmod/libkmod/python/kmod/.libs" ipython
> 
> In [1]: import kmod
> ---------------------------------------------------------------------------
> ImportError                               Traceback (most recent call last)
> <ipython-input-1-ff824b795612> in <module>()
> ----> 1 import kmod
> 
> ImportError: dynamic module does not define init function (initkmod)
> 
> Is this what you're seeing as well?


humn... indeed. The error was obfuscated for me because in the
__init__.py you catch the exception and make it pass silently.

In the build system I was inheriting the CFLAGS from the library and
unfortunately PyMODINIT_FUNC doesn't include the visibility attribute.
Since we use -fvisibility=hidden by default, this was breaking the
module.

It's working now, though I don't like to let it as -fvisibility=default.

I just pushed the python branch again. Could you ack on it?

thanks

-- 
Lucas De Marchi

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [announce] python-kmod 0.9
  2014-03-26 17:45               ` Lucas De Marchi
@ 2014-03-26 20:32                 ` Andy Grover
  2014-03-26 20:49                   ` Lucas De Marchi
  0 siblings, 1 reply; 11+ messages in thread
From: Andy Grover @ 2014-03-26 20:32 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Lucas De Marchi, Lucas De Marchi, linux-modules, W. Trevor King

On 03/26/2014 10:45 AM, Lucas De Marchi wrote:
> On Mon, Mar 24, 2014 at 10:12:26AM -0700, Andy Grover wrote:
>> On 03/24/2014 05:02 AM, Lucas De Marchi wrote:
>>> I've just pushed a branch named "python" which contains the python
>>> bindings. I did it a bit different than you:
>>>
>>>   - All the code from your repository was imported maintaining the
>>> history. I would like to keep it, so I did a merge of the final import
>>> (fast forward, but forced to contain a commit).
>>>   - Python bindings are built with autotools. This allows to easily
>>> express the dependency with libkmod... but I'm not sure this is ideal
>>> as opposed to having a target to explicitely calling setuptools.  Any
>>> opinion?
>>>
>>> Then I noticed the example given in the README file doesn't work.
>>> Neither by installing they original python-kmod package :-/
>>>
>>>      >>> import kmod
>>>      >>> km = kmod.Kmod()
>>>      Traceback (most recent call last):
>>>        File "<stdin>", line 1, in <module>
>>>      AttributeError: 'module' object has no attribute 'Kmod'
>>>      >>> dir(kmod)
>>>      ['__builtins__', '__doc__', '__file__', '__loader__', '__name__',
>>> '__package__', '__path__', '__version__', 'list', 'version']
>>>
>>
>> The old 'python-kmod' pkg works for me:
>>
>> [agrover@work ~/.../python/kmod ((fac4d09...))]$ ipython
>>
>> In [1]: import kmod
>>
>> In [2]: km = kmod.Kmod()
>>
>> In [3]: sc = list(km.lookup("soundcore"))[0]
>>
>> In [4]: sc.path
>> Out[4]: u'/lib/modules/3.13.6-200.fc20.x86_64/kernel/sound/soundcore.ko'
>>
>> but when I try to use the new stuff:
>>
>> [agrover@work ~/.../python/kmod ((fac4d09...))]$
>> PYTHONPATH="/home/agrover/git/kmod/libkmod/python/kmod/.libs" ipython
>>
>> In [1]: import kmod
>> ---------------------------------------------------------------------------
>> ImportError                               Traceback (most recent call last)
>> <ipython-input-1-ff824b795612> in <module>()
>> ----> 1 import kmod
>>
>> ImportError: dynamic module does not define init function (initkmod)
>>
>> Is this what you're seeing as well?
>
>
> humn... indeed. The error was obfuscated for me because in the
> __init__.py you catch the exception and make it pass silently.
>
> In the build system I was inheriting the CFLAGS from the library and
> unfortunately PyMODINIT_FUNC doesn't include the visibility attribute.
> Since we use -fvisibility=hidden by default, this was breaking the
> module.
>
> It's working now, though I don't like to let it as -fvisibility=default.
>
> I just pushed the python branch again. Could you ack on it?

I'm still getting this error.

[agrover@work ~/git/kmod (python)]$ 
PYTHONPATH="/home/agrover/git/kmod/libkmod/python/kmod/.libs" python
Python 2.7.5 (default, Feb 19 2014, 13:47:28)
[GCC 4.8.2 20131212 (Red Hat 4.8.2-7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import kmod
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "list.pxd", line 21, in init kmod.kmod 
(libkmod/python/kmod/kmod.c:3831)
ImportError: No module named list

I'm sorry I'm not being more help.. maybe we could get W. Trevor King or 
another Cython contributor to help us out here? I played around with it 
a bit and changing "kmod.list" to "list" on the line reporting an error 
in kmod.c seemed to help, and then repeating for additional errors, but 
kmod.c is a generated file so that's not the actual solution.

Regards -- Andy

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [announce] python-kmod 0.9
  2014-03-26 20:32                 ` Andy Grover
@ 2014-03-26 20:49                   ` Lucas De Marchi
  2014-03-26 20:56                     ` Andy Grover
  0 siblings, 1 reply; 11+ messages in thread
From: Lucas De Marchi @ 2014-03-26 20:49 UTC (permalink / raw)
  To: Andy Grover; +Cc: Lucas De Marchi, linux-modules, W. Trevor King

On Wed, Mar 26, 2014 at 5:32 PM, Andy Grover <agrover@redhat.com> wrote:
> On 03/26/2014 10:45 AM, Lucas De Marchi wrote:
>>
>> On Mon, Mar 24, 2014 at 10:12:26AM -0700, Andy Grover wrote:
>>>
>>> On 03/24/2014 05:02 AM, Lucas De Marchi wrote:
>>>>
>>>> I've just pushed a branch named "python" which contains the python
>>>> bindings. I did it a bit different than you:
>>>>
>>>>   - All the code from your repository was imported maintaining the
>>>> history. I would like to keep it, so I did a merge of the final import
>>>> (fast forward, but forced to contain a commit).
>>>>   - Python bindings are built with autotools. This allows to easily
>>>> express the dependency with libkmod... but I'm not sure this is ideal
>>>> as opposed to having a target to explicitely calling setuptools.  Any
>>>> opinion?
>>>>
>>>> Then I noticed the example given in the README file doesn't work.
>>>> Neither by installing they original python-kmod package :-/
>>>>
>>>>      >>> import kmod
>>>>      >>> km = kmod.Kmod()
>>>>      Traceback (most recent call last):
>>>>        File "<stdin>", line 1, in <module>
>>>>      AttributeError: 'module' object has no attribute 'Kmod'
>>>>      >>> dir(kmod)
>>>>      ['__builtins__', '__doc__', '__file__', '__loader__', '__name__',
>>>> '__package__', '__path__', '__version__', 'list', 'version']
>>>>
>>>
>>> The old 'python-kmod' pkg works for me:
>>>
>>> [agrover@work ~/.../python/kmod ((fac4d09...))]$ ipython
>>>
>>> In [1]: import kmod
>>>
>>> In [2]: km = kmod.Kmod()
>>>
>>> In [3]: sc = list(km.lookup("soundcore"))[0]
>>>
>>> In [4]: sc.path
>>> Out[4]: u'/lib/modules/3.13.6-200.fc20.x86_64/kernel/sound/soundcore.ko'
>>>
>>> but when I try to use the new stuff:
>>>
>>> [agrover@work ~/.../python/kmod ((fac4d09...))]$
>>> PYTHONPATH="/home/agrover/git/kmod/libkmod/python/kmod/.libs" ipython
>>>
>>> In [1]: import kmod
>>>
>>> ---------------------------------------------------------------------------
>>> ImportError                               Traceback (most recent call
>>> last)
>>> <ipython-input-1-ff824b795612> in <module>()
>>> ----> 1 import kmod
>>>
>>> ImportError: dynamic module does not define init function (initkmod)
>>>
>>> Is this what you're seeing as well?
>>
>>
>>
>> humn... indeed. The error was obfuscated for me because in the
>> __init__.py you catch the exception and make it pass silently.
>>
>> In the build system I was inheriting the CFLAGS from the library and
>> unfortunately PyMODINIT_FUNC doesn't include the visibility attribute.
>> Since we use -fvisibility=hidden by default, this was breaking the
>> module.
>>
>> It's working now, though I don't like to let it as -fvisibility=default.
>>
>> I just pushed the python branch again. Could you ack on it?
>
>
> I'm still getting this error.
>
> [agrover@work ~/git/kmod (python)]$
> PYTHONPATH="/home/agrover/git/kmod/libkmod/python/kmod/.libs" python
> Python 2.7.5 (default, Feb 19 2014, 13:47:28)
> [GCC 4.8.2 20131212 (Red Hat 4.8.2-7)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import kmod
>
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "list.pxd", line 21, in init kmod.kmod
> (libkmod/python/kmod/kmod.c:3831)
> ImportError: No module named list
>
> I'm sorry I'm not being more help.. maybe we could get W. Trevor King or
> another Cython contributor to help us out here? I played around with it a
> bit and changing "kmod.list" to "list" on the line reporting an error in
> kmod.c seemed to help, and then repeating for additional errors, but kmod.c
> is a generated file so that's not the actual solution.

Humn... yes. If I set PYTHONPATH as opposed to installing I get this
error. I'm not sure what's happening.

-- 
Lucas De Marchi

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [announce] python-kmod 0.9
  2014-03-26 20:49                   ` Lucas De Marchi
@ 2014-03-26 20:56                     ` Andy Grover
  0 siblings, 0 replies; 11+ messages in thread
From: Andy Grover @ 2014-03-26 20:56 UTC (permalink / raw)
  To: Lucas De Marchi; +Cc: Lucas De Marchi, linux-modules, W. Trevor King

On 03/26/2014 01:49 PM, Lucas De Marchi wrote:
> On Wed, Mar 26, 2014 at 5:32 PM, Andy Grover <agrover@redhat.com> wrote:
>> On 03/26/2014 10:45 AM, Lucas De Marchi wrote:
>>>
>>> On Mon, Mar 24, 2014 at 10:12:26AM -0700, Andy Grover wrote:
>>>>
>>>> On 03/24/2014 05:02 AM, Lucas De Marchi wrote:
>>>>>
>>>>> I've just pushed a branch named "python" which contains the python
>>>>> bindings. I did it a bit different than you:
>>>>>
>>>>>    - All the code from your repository was imported maintaining the
>>>>> history. I would like to keep it, so I did a merge of the final import
>>>>> (fast forward, but forced to contain a commit).
>>>>>    - Python bindings are built with autotools. This allows to easily
>>>>> express the dependency with libkmod... but I'm not sure this is ideal
>>>>> as opposed to having a target to explicitely calling setuptools.  Any
>>>>> opinion?
>>>>>
>>>>> Then I noticed the example given in the README file doesn't work.
>>>>> Neither by installing they original python-kmod package :-/
>>>>>
>>>>>       >>> import kmod
>>>>>       >>> km = kmod.Kmod()
>>>>>       Traceback (most recent call last):
>>>>>         File "<stdin>", line 1, in <module>
>>>>>       AttributeError: 'module' object has no attribute 'Kmod'
>>>>>       >>> dir(kmod)
>>>>>       ['__builtins__', '__doc__', '__file__', '__loader__', '__name__',
>>>>> '__package__', '__path__', '__version__', 'list', 'version']
>>>>>
>>>>
>>>> The old 'python-kmod' pkg works for me:
>>>>
>>>> [agrover@work ~/.../python/kmod ((fac4d09...))]$ ipython
>>>>
>>>> In [1]: import kmod
>>>>
>>>> In [2]: km = kmod.Kmod()
>>>>
>>>> In [3]: sc = list(km.lookup("soundcore"))[0]
>>>>
>>>> In [4]: sc.path
>>>> Out[4]: u'/lib/modules/3.13.6-200.fc20.x86_64/kernel/sound/soundcore.ko'
>>>>
>>>> but when I try to use the new stuff:
>>>>
>>>> [agrover@work ~/.../python/kmod ((fac4d09...))]$
>>>> PYTHONPATH="/home/agrover/git/kmod/libkmod/python/kmod/.libs" ipython
>>>>
>>>> In [1]: import kmod
>>>>
>>>> ---------------------------------------------------------------------------
>>>> ImportError                               Traceback (most recent call
>>>> last)
>>>> <ipython-input-1-ff824b795612> in <module>()
>>>> ----> 1 import kmod
>>>>
>>>> ImportError: dynamic module does not define init function (initkmod)
>>>>
>>>> Is this what you're seeing as well?
>>>
>>>
>>>
>>> humn... indeed. The error was obfuscated for me because in the
>>> __init__.py you catch the exception and make it pass silently.
>>>
>>> In the build system I was inheriting the CFLAGS from the library and
>>> unfortunately PyMODINIT_FUNC doesn't include the visibility attribute.
>>> Since we use -fvisibility=hidden by default, this was breaking the
>>> module.
>>>
>>> It's working now, though I don't like to let it as -fvisibility=default.
>>>
>>> I just pushed the python branch again. Could you ack on it?
>>
>>
>> I'm still getting this error.
>>
>> [agrover@work ~/git/kmod (python)]$
>> PYTHONPATH="/home/agrover/git/kmod/libkmod/python/kmod/.libs" python
>> Python 2.7.5 (default, Feb 19 2014, 13:47:28)
>> [GCC 4.8.2 20131212 (Red Hat 4.8.2-7)] on linux2
>> Type "help", "copyright", "credits" or "license" for more information.
>>>>> import kmod
>>
>> Traceback (most recent call last):
>>    File "<stdin>", line 1, in <module>
>>    File "list.pxd", line 21, in init kmod.kmod
>> (libkmod/python/kmod/kmod.c:3831)
>> ImportError: No module named list
>>
>> I'm sorry I'm not being more help.. maybe we could get W. Trevor King or
>> another Cython contributor to help us out here? I played around with it a
>> bit and changing "kmod.list" to "list" on the line reporting an error in
>> kmod.c seemed to help, and then repeating for additional errors, but kmod.c
>> is a generated file so that's not the actual solution.
>
> Humn... yes. If I set PYTHONPATH as opposed to installing I get this
> error. I'm not sure what's happening.
>

Ah ok! PYTHONPATH needs to be to "...site-packages", not 
"...site-packages/kmod". so I'm all good :-)

Acked-by: Andy Grover <agrover@redhat.com>

Thanks! -- Andy

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-03-26 20:56 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <509C4944.3040907@redhat.com>
2013-11-11 19:28 ` [announce] python-kmod 0.9 Lucas De Marchi
2013-11-11 19:40   ` Andy Grover
2013-12-18 19:38     ` Lucas De Marchi
2013-12-19  1:20       ` Andy Grover
2013-12-22 21:52         ` Lucas De Marchi
2014-03-24 12:02           ` Lucas De Marchi
2014-03-24 17:12             ` Andy Grover
2014-03-26 17:45               ` Lucas De Marchi
2014-03-26 20:32                 ` Andy Grover
2014-03-26 20:49                   ` Lucas De Marchi
2014-03-26 20:56                     ` Andy Grover

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.