Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python strange exception. Have I found my first Python bug or is this a noob mistake?

Tags:

python

Let me start by saying, I also get the same error whey defining __init__ and running super()'s __init__. I only simplified it down to this custom method to see if the error still happened.

import HTMLParser

class Spider(HTMLParser):
    """
    Just a subclass.
    """

This alone in a module raises the following error:

Traceback (most recent call last):
  File "D:\my\path\to\my\file
    class Spider(HTMLParser):
TypeError: Error when calling the metaclass bases
    module.__init__() takes at most 2 arguments (3 given)
like image 704
orokusaki Avatar asked Feb 12 '10 17:02

orokusaki


People also ask

How do you identify a bug in Python?

Pychecker and Pylint are the static analysis tools that help to find bugs in python. Pychecker is an opensource tool for static analysis that detects the bugs from source code and warns about the style and complexity of the bug.

Is Python an error?

The most common reason of an error in a Python program is when a certain statement is not in accordance with the prescribed usage. Such an error is called a syntax error. The Python interpreter immediately reports it, usually along with the reason. >>> print "hello" SyntaxError: Missing parentheses in call to 'print'.


1 Answers

And the answer is that I'm a complete noob. This is a module, not a class, but I'll leave this up here in case other noobs run into the same problem.

Solution:

from HTMLParser import HTMLParser

Each time I think I'm starting to become a pro, something like this happens :(

like image 87
orokusaki Avatar answered Oct 11 '22 05:10

orokusaki