Python Forum
Super with Sublime Text - TypeError: super() takes at least 1 argument (0 given)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Super with Sublime Text - TypeError: super() takes at least 1 argument (0 given)
#1
Hi
I am trying to use the super function. I am getting the following message;

Error:
File "/Users/shaneshomefolder/Documents/Lists/numercial lists /inheratence_take_2.py", line 41, in __init__ super().__init__(make, model, backlight, battery, screentype) TypeError: super() takes at least 1 argument (0 given)
I am trying to follow a lesson online and am following the instructions exactly and continue to get this error. my code is
##30/04/19
##Shane Flanagan
##increment atrabutes through method

class Ereader():
	"""A class to represent an ereader"""

	def __init__ (self, make, model, backlight, battery, screentype):
		"""inatilase the atributes to represent an ererader"""
		self.make=make
		self.model=modle
		self.backlight=backlight
		self.battery=battery
		self.screentype=screentype 
		self.libararycount=0

	def get_ereader_name(self):
		"""return a formatted description for our ereader"""
		long_name = self.make + " - " + self.model + " - " +self.backlight + " - " + self.battery + "-" + self.screentype
		return long_name.title()

	def read_libarary_count(self):
		print("You Have " + str(self.libararycount) + " books in your libarary")


	def update_laibary_count(self, ebook_count):
		"""set the libary count"""
		self.libararycount=ebook_count

	def increment_libary_count(self, purchesed_ebooks):
		"""add new ebboks to libary count"""
		self.libararycount+=purchesed_ebooks

class KindleFire(Ereader):
	"""represents aspects of an ereader spicific to a kindle fire
		then initilaze atributes spicfic to a kindle fire"""
	def __init__(self, make, model, backlight, battery, screentype):
		"""initilize atributes of kindle fire"""
		

		super().__init__(make, model, backlight, battery, screentype)


my_kindle_fire = KindleFire('amazon', 'kindle fire', 'backlight', 'long life', 'color screen')
print(my_kindle_fire.get_ereader_name())
Reply
#2
self.model=modle model is spelt wrong here in the __init__ of Ereader
with that corrected i don't get your error.
i get
Output:
Amazon - Kindle Fire - Backlight - Long Life-Color Screen
Reply
#3
that is exactly the out put i am trying to get but i still get the error even with the correction. strange!! i am using Sublime Text.

Output:
Traceback (most recent call last): File "/Users/shaneshomefolder/Documents/Lists/numercial lists /inheratence_take_2.py", line 44, in <module> my_kindle_fire = KindleFire('amazon', 'kindle fire', 'backlight', 'long life', 'color screen') File "/Users/shaneshomefolder/Documents/Lists/numercial lists /inheratence_take_2.py", line 41, in __init__ super().__init__(make, model, backlight, battery, screentype) TypeError: super() takes at least 1 argument (0 given) [Finished in 0.2s with exit code 1] [shell_cmd: python -u "/Users/shaneshomefolder/Documents/Lists/numercial lists /inheratence_take_2.py"] [dir: /Users/shaneshomefolder/Documents/Lists/numercial lists ] [path: /Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin]

it works when i put it in my IDE. Odd!
Reply
#4
Is Sublime Text configured to using python 2, in which it would require super(KindleFire, self).__init__(make, model, backlight, battery, screentype) hence the error.
Reply
#5
How can i change the configuration from Python 2 to 3?
Reply
#6
https://forum.sublimetext.com/t/having-t...hon3/30571
Reply
#7
Thats great Yoriz.. thank you!!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  super() and order of running method in class inheritance akbarza 7 594 Feb-04-2024, 09:35 AM
Last Post: Gribouillis
  problem with print command in super() akbarza 5 505 Feb-01-2024, 12:25 PM
Last Post: deanhystad
  super() in class akbarza 1 402 Dec-19-2023, 12:55 PM
Last Post: menator01
  while loop not working-I am using sublime text editor mma_python 4 1,060 Feb-05-2023, 06:26 PM
Last Post: deanhystad
  Error TypeError: output_type_handler() takes 2 positional arguments but 6 were given paulo79 1 1,858 Oct-17-2022, 06:29 PM
Last Post: paulo79
  TypeError: float() argument must be a string or a number, not 'list' Anldra12 2 4,763 Jul-01-2022, 01:23 PM
Last Post: deanhystad
  Sublime Text Editor not recognizing Python elroberto 5 2,802 Jun-13-2022, 04:00 PM
Last Post: rob101
  super multiple parallel classes catlessness 2 1,294 Jun-07-2022, 02:35 PM
Last Post: deanhystad
  Error: _vhstack_dispatcher() takes 1 positional argument but 9 were given alexfrol86 3 5,717 May-09-2022, 12:49 PM
Last Post: deanhystad
  TypeError: missing a required argument: 'y' gible 0 2,844 Dec-15-2021, 02:21 AM
Last Post: gible

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020