Type error in Service Routine



  • I randomly get the following error:

    Unhandled exception in callback handler
    TypeError: 'bytearray' object is not callable
    

    or

    Unhandled exception in callback handler
    TypeError: 'slice' object is not callable
    

    This happens in a callback which is triggerd by a pin interrupt. Defined like so:

    int_pin.callback(trigger=Pin.IRQ_RISING, handler=self.handler)

    The callback function is a very simple method of an object:

    def handler(self, arg):
        self.todo = True
    

    Actually, there is no such type as slice or bytearray involved in the callback which makes me think its a bug ...

    Sometimes the callback works fine for several thousands of times, some times for just a few hundreds.
    After that exception the callback seems to be never called again, even tough it should have been called again.

    I have a main loop which looks as follows and shall handle the todos:

    while True:
        irq = machine.disable_irq()
        if this.todo:
            this.todo = False
            do_this()
        if that.todo:
            that.todo = False
            do_that()
        machine.enable_irq(irq)
        time.sleep_us(1)
    

    Any ideas?

    Oh yea, forgot to mention:

    (sysname='LoPy', nodename='LoPy', release='1.6.12.b1', version='v1.8.6-593-g8e4ed0fa on 2017-04-12', machine='LoPy with ESP32', lorawan='1.0.0')
    

Log in to reply
 

Pycom on Twitter