0

I have this asyncio class in python 3.4:

class Type1:

    def __init__(s,websocket,path,flds,MyId):
        global TypeOnes
        s.ws=websocket
        s.pt=path
        s.iId=flds
        s.ID=MyId
        s.cnt=0
        TypeOnes[MyId]=s
        s.Q=asyncio.Queue


    @asyncio.coroutine
    def handlerIn(s,rxed):
        #yield from s.Q.put(rxed)  # gave error missing positional 'item'
        #yield from s.Q.put(item=rxed)   # gave error missing positional 'self'
        yield from s.Q.put(self=s.Q,item=rxed) # gave error TypeError: _consume_done_getters() missing 1 required positional argument: 'self'

When HandlerIn is called I do not seem to be able to call Q.put, see commented code for attempts and results.

It's as if the self is just not being inserted correctly

I am in a debugger and I have checked the contents of the variables:

(handlerIn)>>> s.Q
<class 'asyncio.queues.Queue'>

(handlerIn)>>> rxed
'Button'

1 Answer 1

4

I think the problem is that you haven't created an instance of asyncio.Queue. It should be

s.Q=asyncio.Queue()
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.