« Monitors in spaaaaaace.... | Main | Using Furl with Aardvark? »

March 30, 2005

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d83452fe4869e200d83552028569e2

Listed below are links to weblogs that reference TypeError: Error when calling the metaclass bases:

Comments

Andrew VanderVeen

Wow, thanks for this post. I also use Java and had exactly the experience you described. "The Oracle" helped too ;)

Victor Freire

Really helpful tip. Coming back to Python from Java as well and just came upon that mysterious error.


Brandon Rhodes

And it turns out that there is another case in which this error is generated: where you thought you defined a class but it turns out that you said "def" instead of "class" but since functions can be nested inside of functions Python accepted the syntax so it took you twenty minutes to notice the problem. Which I wanted to mention just in case anyone else who ever types "def" instead of "class" winds up doing the same Google search that I just did. :-)

Rob L

I've stopped to search Google more than once on this one, each time for the same brainfart:

1) Just go ahead and develop the class right in main.py until it's kinda working
2) Create a new file Source/MyNewHalfBakedClass.py and move the code into it
3) Add "from Source import MyNewHalfBakedClass.py"
4) Try running the bugs out... get that funky error... and then remember the magical:
5) Add "from MyNewHalfBakedClass import *" to the mystical file Source/__init__.py

No need to rename anything, and it's super-obvious (to me) that MyNewHalfBakedClass is in a file with that same name. HTH and FWIW

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been saved. Comments are moderated and will not appear until approved by the author. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

Comments are moderated, and will not appear until the author has approved them.

My Photo

Become a Fan

My Other Accounts

Facebook Skype Twitter