So does this exception come with a map, and some food?

August 8th, 2008 § 8 comments

I ran across this excep­tion again today dur­ing some read­ing — and when I first hit it some time ago, I gave it the label of “best python error” (and put it in a bugzilla quip list).


TypeError: Error when calling the metaclass bases
metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

Every time I read this error, my brain con­vulses and I sud­denly find that it’s 3 hours later and I’m not wear­ing pants.

Seri­ously: this error could be bet­ter done as:


TypeError: You're doomed!
1> Open the chest
2> back out of the room slowly
3> attack the ogre

Of course, I’m being sar­cas­tic for those of you with a bro­ken laugh-o-meter.

I just thought about some­thing — what if you made error mes­sages “realer” like:

IOError: you can not access that thingie right now, it's either not on disk, unavailable - or your stupid USB disk powered off again nubcakes


MemoryError: How in the hell did you do this in a language with GC? Stop it. STOP. OH GOD IT BUR (oomkill from kernel)

  • Doug Napoleone

    The error thrown need only be one order of mag­ni­tude eas­ier to under­stand than the lan­guage fea­ture you are using which is caus­ing the prob­lem. Given that this is python meta­classes we are talk­ing about, I would say that the error mes­sage is much clearer than expected ;-)

    I cant remem­ber where I last saw this error, but it was eather caused by mul­ti­ple inher­i­tance (with meta­classes and improper super use when deal­ing with them), and/or mix­ing old and new style classes with meta­classes. Remem­ber your (object).

    I would be inter­ested to see the code caus­ing the prob­lem, and what the actual issue is.
    But then again, I don’t think I want to hurt my head like that.…

  • jnoller

    Yes, this stems from fubar­ing your inheritance/metaclasses. Inter­est­ingly enough plug/ there was a pymag arti­cle this past month try­ing to demys­tify meta­classes: I highly rec­om­mend it /plug. Of course, you’re right — the error should match the dif­fi­culty of the code.

    Of course, where does that put some­thing like thread­ing? “Error: No, don’t share state, you’re screwed any­ways. Quit now” :)

  • http://www.montereycountyweekly.com Kevin Smith

    ROFL that’s awesome.

  • Pawel Murias

    The error sounds per­fectly rea­son­able if you know what meta­classes are and pro­vided it’s an issue with them

  • Doug Napoleone

    The error thrown need only be one order of mag­ni­tude eas­ier to under­stand than the lan­guage fea­ture you are using which is caus­ing the prob­lem. Given that this is python meta­classes we are talk­ing about, I would say that the error mes­sage is much clearer than expected ;-)

    I cant remem­ber where I last saw this error, but it was eather caused by mul­ti­ple inher­i­tance (with meta­classes and improper super use when deal­ing with them), and/or mix­ing old and new style classes with meta­classes. Remem­ber your (object).

    I would be inter­ested to see the code caus­ing the prob­lem, and what the actual issue is.
    But then again, I don’t think I want to hurt my head like that.…

  • http://jessenoller.com jnoller

    Yes, this stems from fubar­ing your inheritance/metaclasses. Inter­est­ingly enough plug/ there was a pymag arti­cle this past month try­ing to demys­tify meta­classes: I highly rec­om­mend it /plug. Of course, you’re right — the error should match the dif­fi­culty of the code.

    Of course, where does that put some­thing like thread­ing? “Error: No, don’t share state, you’re screwed any­ways. Quit now” :)

  • http://www.montereycountyweekly.com Kevin Smith

    ROFL that’s awesome.

  • Pawel Murias

    The error sounds per­fectly rea­son­able if you know what meta­classes are and pro­vided it’s an issue with them

What's this?

You are currently reading So does this exception come with a map, and some food? at jessenoller.com.

meta