Error saying TypeError descriptor object needs an argument

0 votes

I have this python code:

class A:
    def __init__(self, name):
        self.name = name

class B(A):
    def __init__(self):
        super.__init__()

And I get the following error:

TypeError
Traceback (most recent call last)
<ipython-input-7-ea9745abfeb2> in <module>()
----> 1 C = B()

<ipython-input-4-2d2ef2cc5406> in __init__(self)
  5 class B(A):
  6   def __init__(self):
----> 7     super.__init__()

TypeError: descriptor '__init__' of 'super' object needs an argument
May 28, 2019 in Python by Vishal
12,893 views

1 answer to this question.

0 votes

The error is pretty straight forward, toy need to pass an argument to the function super()

class A:
    def __init__(self, name):
        self.name = name

class B(A):
    def __init__(self, name):
        super().__init__(name)
answered May 28, 2019 by Alisha

Related Questions In Python

0 votes
1 answer

Python error "TypeError: 'encoding' is an invalid keyword argument for this function"

Trying using the io module for this ...READ MORE

answered Aug 2, 2019 in Python by Vaishali

edited Oct 7, 2021 by Sarfaraz 14,071 views
0 votes
0 answers

Help, How can I fix this? TypeError: Getting error as __init__() got an unexpected keyword argument 'rotaion_range'.

datagen = ImageDataGenerator(zoom_range=0.2,rotaion_range=10,width_shift_range=0.1, height_shift_range=0.1,horizontal_flip=True, vertical_flip = False ...READ MORE

Oct 20, 2021 in Python by anonymous
• 120 points
339 views
0 votes
1 answer

Python error "TypeError: range() integer end argument expected, got numpy.float64."

Hi @Kashish, try something like this: for i ...READ MORE

answered May 27, 2019 in Python by Harish
2,702 views
0 votes
1 answer

Error saying "ValueError: Invalid file object: <_io.BufferedReader name=9>"

Once you've executed the following command, your ...READ MORE

answered May 28, 2019 in Python by Tamanna
5,038 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,080 views
0 votes
1 answer
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,790 points
3,502 views
0 votes
1 answer

Error saying "TypeError: range() integer end argument expected"

Try this: [x * 0.01 for x in ...READ MORE

answered May 27, 2019 in Python by Keshav
1,084 views
0 votes
1 answer

How can I print an Error in Python?

For Python 2.6 and later and Python ...READ MORE

answered Oct 12, 2018 in Python by aryya
• 7,450 points
836 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP