Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Type error in Service Routine

    Scheduled Pinned Locked Moved Issues & Bugs
    irqcallback
    1 Posts 1 Posters 747 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T Offline
      this.wiederkehr
      last edited by this.wiederkehr

      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')
      
      1 Reply Last reply Reply Quote 0

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      • 1 / 1
      • First post
        Last post

      Pycom on Twitter

      Pycom