python - What is causing this TypeError? -
I have two separate files, which have two separate classes (let them be replaced by class and when I send my code to: To run, I get this It's telling me to pass There are 4 arguments for 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 Pre> code>, first Note: I suggest you follow the PEP 8 guidelines, and your module should use the following-case names. Thus Foo And
times ). In the file (
Foo.py )
Foo , I have:
square fu: def __init __ (auto): ...
Bar.py )>, with me Foo class bar (Foo.Foo): def __init __ (self): ...
TypeError :
traceback (most recent call final): File "Bar.py", line 2,
__init __ when code is the only argument, then
self
foo.py inside a class
Foo then you can use it like this: < You can also:
but you are trying to do this:
foo is your class.
. parses
foo after python and looks for a class member called
Foo .
foo.py instead of
foo.py .
Comments
Post a Comment