I would prefer to do something with publisher module. The example that was
included with this topic is for to show the problem only.
I am using publisher in couple of files where I am about to change the code to
get the maximum gain using cython(cdef, loops and other stuff).
Now I have to find a solution for this problem first, later I'll jump for
conversion.
Could you please suggest me some hacks that would make this thing work If I
would do some changes in pubsub modules or anything?
Prashant
----- Original Message ----
From: Robert Bradshaw <[EMAIL PROTECTED]>
To: [email protected]
Sent: Monday, 13 October, 2008 5:06:20 PM
Subject: Re: [Cython] pubsub module and cython
That is correct, arg is not a Python function, it is a compiled
function. It looks like the listener interface can only accept pure
Python functions.
You could look at trying to fix wx, but I would recommend writing
your test.py as an ordinary Python module (it doesn't look like that
part of the code will benefit from Cython much) and wrapping the
speed-critical/library interface parts in Cython.
- Robert
On Oct 13, 2008, at 4:11 AM, Prashant Saxena wrote:
> Ok, Here are the details
>
> Os win 2k
> python 2.5.2
> cython 0.9.8.1.1
>
> 1. I am using pure python code to convert .py into .c and compile
> using mingw32.( no cdef stuff)
> 2. test.py is working fine until unless I am converting into c
> extension.
> 3. When using test.pyd, I am getting following error:
>
> Traceback (most recent call last):
> File "demo.py", line 1, in <module>
> import test
> File "test.py", line 33, in test (test.c:831)
> app.MainLoop()
> File "test.py", line 18, in test.MyButtons.__init__ (test.c:413)
>
> File "C:\Python25\Lib\site-packages\pubsubcore\publisher.py",
> line 86, in subscribe
> topicName, desc=noDesc, usingCallable=listener)
> File "C:\Python25\Lib\site-packages\pubsubcore\topics.py", line
> 423, in _newTopicFromTemplate_
> allArgsDocs, required = topicArgsFromCallable(usingCallable)
> File "C:\Python25\Lib\site-packages\pubsubcore\topics.py", line
> 618, in topicArgsFromCallable
> argsInfo = getListenerArgs(_callable)
> File "C:\Python25\lib\site-packages\pubsubcore\callables.py",
> line 158, in getArgs
> (args, va, vkwa, defaultVals) = getargspec(func)
> File "C:\Python25\lib\inspect.py", line 742, in getargspec
> raise TypeError('arg is not a Python function')
> TypeError: arg is not a Python function
>
>
> In second last line of error it seems the listener(self.OnPubSub)
> at line no. 17 in test.py:
> Publisher.subscribe(self.OnPubSub, "topic")
> is changed into something else which "inspect.py" is not able to
> recognized as a function.
> Although subscription method is almost same as wxPython events
> binding, which is getting compiled and giving no problems.
>
> I gave a try to pydispatch module and wx.lib.pubsub module to do
> the same thing but none of them are working when test.py is
> compiled into .pyd.
> All of the modules are showing same type of error at line no.17
> where we are subscribing our listener. Still I am not able to
> fugure out where actually the problem is, is it in the modules or
> is it with cython?
>
> Hope this helps.
>
> Prashant
>
>
> ----- Original Message ----
> From: Stefan Behnel <[EMAIL PROTECTED]>
> To: [email protected]
> Sent: Monday, 13 October, 2008 3:23:35 PM
> Subject: Re: [Cython] pubsub module and cython
>
> Hi,
>
> it's usually a good idea to provide some more more information than
> "doing
> something wrong" and "an error" in your problem report, especially
> some
> hints on what the error output is. Otherwise, you require everyone to
> unpack your test code, compile it and run it, although the error
> description might already give some (or even enough) hints on what
> goes
> wrong and who might be able to help you.
>
> Stefan
>
> Prashant Saxena wrote:
> > I did a simple test of using pubsub module and cython. It seems
> cython is
> > doing something wrong and not able to properly handle listener.
> > The code is zipped here.
> >
> > 1. Run "test.py" and everything is working fine.
> > 2. you can compile "test.py" using "setup.bat" on windows. Compiled
> > "test.pyd" is also available.
> > 3. Run "demo.py". Here you have an error.
> >
> > Regards
> >
> > Prashant
>
> _______________________________________________
> Cython-dev mailing list
> [email protected]
> http://codespeak.net/mailman/listinfo/cython-dev
>
> Add more friends to your messenger and enjoy! Invite them now.
> _______________________________________________
> Cython-dev mailing list
> [email protected]
> http://codespeak.net/mailman/listinfo/cython-dev
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev
Be the first one to try the new Messenger 9 Beta! Go to
http://in.messenger.yahoo.com/win/_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev