question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

super(type, obj): obj must be an instance or subtype of type

See original GitHub issue

I’m trying to get raven client working with celery. Initially things weren’t working because of the inability to use class methods as tasks (issue 59).

The relevant code is in CeleryMxin:

    def send_raw(self, *args, **kwargs):
        return super(CeleryMixin, self).send_encoded(*args, **kwargs)

After a couple of hours, I was no longer getting that error, but instead was getting the new error below. Note that this error somehow creates another error message to be tried and published, so celeryd gets into an infinite loop.

TypeError: super(type, obj): obj must be an instance or subtype of type
[2012-07-07 05:12:48,397: INFO/MainProcess] Got task from broker: raven.contrib.celery.send_raw[6e9a
a446-8fa3-4828-b96c-dff7317beffd]
[2012-07-07 05:12:48,398: INFO/MainProcess] Got task from broker: raven.contrib.celery.send_raw[8ec5
7888-0ac5-4388-902f-65b7800bf184]
[2012-07-07 05:12:48,420: ERROR/MainProcess] Task raven.contrib.celery.send_raw[50f6eeb1-99a1-4357-a
75f-0649ee3040b1] raised exception: TypeError('super(type, obj): obj must be an instance or subtype
of type',)
Traceback (most recent call last):
  File "F:\taras\programming\goparcel\venv\lib\site-packages\celery\execute\trace.py", line 181, in
trace_task
    R = retval = fun(*args, **kwargs)

Googling the eror message leads to:

http://thingspython.wordpress.com/2010/09/27/another-super-wrinkle-raising-typeerror/

Which looks like mxins & reloading modules can both cause this error.

Sure enough if I print

    @task
    def send_raw(self, *args, **kwargs):
        print "INSTANCE: ", isinstance(self, CeleryMixin)

I get false

if I try to explicitly call the method:

lArgs  = [self] + list(args)
DjangoClient.send_encoded(*lArgs, **kwargs)

I get an error message saying that the first element needs to be an instance of DjangoClient, but a str was received instead.

Trying to copy/paste the mixincode to CeleryClient, and removing the multiple inheritance so that it only inherits from DjangoClient, gets the same error message (both when calling super and when calling explicitly via DjangoClient).

Printing out ‘self’ prints out a massive random looking string.

Using celery and django-celery 2.5.5.

Issue Analytics

  • State:closed
  • Created 11 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
komuwcommented, Jan 18, 2018

for anyone else who gets directed by google to this page in search of answers, I think your answer lies in:

  1. https://thingspython.wordpress.com/2010/09/27/another-super-wrinkle-raising-typeerror/
  2. http://thomas-cokelaer.info/blog/2011/09/382/
0reactions
orenyomtovcommented, Jul 31, 2018

This is now a problem for me with Flask and APScheduler. Did anyone find a solution to the problem?

Read more comments on GitHub >

github_iconTop Results From Across the Web

super(type, obj): obj must be an instance or subtype of type
Another way this error can occur is when you reload the module with the class in a Jupiter notebook. Easy solution is to...
Read more >
super(type, obj): obj must be an instance or subtype of type ...
I get a TypeError: super(type, obj): obj must be an instance or subtype of type when rendering a View which has been reloaded...
Read more >
super(type, obj): obj must be an instance or subtype of type ...
Does throw TypeError: super(type, obj): obj must be an instance or subtype of type when a module is reloaded and the implementation is...
Read more >
super(type, obj): obj must be an instance or subtype of type
Super is a problem when a class is using multiple inheritance. But you aren't using multiple inheritance here. I would recommend to stop...
Read more >
super(type, obj): obj must be an instance or subtype of type ...
Hi, Reflecting the below error while creating or amending a quotation after version updated to 13.20.1 “TypeError: super(type, obj): obj ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found