Skip to content

MaybeEncodingError while raising error in task #3623

Closed
@hd5970

Description

@hd5970

hi

CELERY_TASK_SERIALIZER: 'pickle'
Celery(broker=BaseConfig.CELERY_BROKER_URL) no backend
VERSION 4.0.0
Python 2.7.12

class CanNotHandleAnyMore(Exception):
    def __init__(self, message):
        self.message = message

    def __repr__(self):
        return self.message

#task code
@celery.task
def balaba():
      # raise ValueError , nothing unexpected happened, Task balaba raised unexpected: ValueError
      raise ValueError
      # raise CanNotHandleAnyMore instance
      raise CanNotHandleAnyMore("I don't wanna handle any more")
      # here comes the exception Task handler raised error in celery stdout
      # traceback
      [2016-11-24 14:55:45,282: ERROR/MainProcess] Task handler raised error: 
<MaybeEncodingError: Error sending result: ''(1, <ExceptionInfo: CanNotHandleAnyMore()>, None)''. Reason: ''PicklingError("Can\'t pickle <class \'src.handlers.base.CanNotHandleAnyMore\'>: it\'s not the same object as src.handlers.base.CanNotHandleAnyMore",)''.>

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions