Python Forum
Why am I getting this error?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Why am I getting this error?
#1
I'm trying to learn how to use Python classes using this one as an example:

class ExampleClass:
...     def __init__(self,example_parameter):
...         self.example_data=33
...         self.example_param=example_parameter
...         print("message from the constructor")
...     def example_method(self):    
...         print(self.example_param)
...     def get_example_data(self):    
...         return self.example_data
...     def set_example_data(self):   
...         self.example_data=value
I keep getting this error message for this functions:
example_class_object.set_example_data(543)
Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
TypeError: ExampleClass.set_example_data() takes 1 positional argument but 2 were given
Reply


Messages In This Thread
Why am I getting this error? - by the_jl_zone - Jun-05-2023, 11:06 PM
RE: Why am I getting this error? - by bowlofred - Jun-05-2023, 11:34 PM
RE: Why am I getting this error? - by snippsat - Jun-06-2023, 12:02 AM
RE: Why am I getting this error? - by rajeshgk - Jun-06-2023, 04:59 PM

Forum Jump:

User Panel Messages

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