[Stackless] Keyword args problem with class inherited from stackless channel

Aseem Mohanty aseem at metaweb.com
Mon Jun 11 21:42:53 CEST 2007


Hi All,

I just downloaded the channelWithReciceveTimeout.py
http://stacklessexamples.googlecode.com/svn/trunk/examples/channelWithReceiveTimeout.py
example and tried to use it in an app and ran into some trouble.

What I tried to do was the following:
1. Modified TimeLimitedReceiveChannel.__init__ to initialize self.expirySeconds from kwargs:

def __init__(self, *args, **kwargs):
        self.expirySeconds = kwargs.get('timeout', 5.0)
        self.receiveAddTimes = []

        stackless.channel.__init__(self, *args, **kwargs)

2. Called the ctor from my code:
	self.rc = TimeLimitedReceiveChannel(timeout=3.0)

On doing so I keep getting the error:
TypeError: 'timeout' is an invalid keyword argument for this function

When I tried the same int he shell - I got the same result:

12:26 PM $ stackless
Python 2.5.1 Stackless 3.1b3 060516 (release25-maint, May 14 2007, 12:58:07) 
[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from timedrecvchannel import *
>>> x = TimeLimitedReceiveChannel(timeout=2)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'timeout' is an invalid keyword argument for this function

An inspect also seems to behave strangely:

>>> inspect.getargspec(TimeLimitedReceiveChannel)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/lib/python2.5/inspect.py", line 743, in getargspec
    raise TypeError('arg is not a Python function')
TypeError: arg is not a Python function

Is there something strange in stackless.channel that does not treat kwargs properly? 

Thanks.
AM

_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless



More information about the Stackless mailing list