python - What is causing this TypeError? -


I have two separate files, which have two separate classes (let them be replaced by Foo And times ). In the file ( Foo.py )

class Foo , I have:

  square fu: def __init __ (auto): ...   

and bar in the file ( Bar.py )>, with me Foo class bar (Foo.Foo): def __init __ (self): ...

when I send my code to: To run, I get this TypeError :

  traceback (most recent call final): File "Bar.py", line 2,   

It's telling me to pass There are 4 arguments for __init __ when code is the only argument, then self

It seems to me that your problem is that you are importing the class directly, but then trying to access it through the module name.

If you have a module source file foo.py inside a class Foo then you can use it like this: < You can also:

Pre> but you are trying to do this:

code>, first foo is your class. . parses foo after python and looks for a class member called Foo .

Note: I suggest you follow the PEP 8 guidelines, and your module should use the following-case names. Thus foo.py instead of foo.py .



Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -