S
Simon
Hi
I want to create an instance of dcCursor which inherits from
dcObject. When I run the following code it gives the error shown.
Can some explain to me what is wrong? I have included the dcObject.py
and dcCursor.py below.
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
TypeError: __init__() takes no arguments (1 given)
# -*- coding: utf-8 -*-
# dcCursor.py - The base Cursor Class
from dcObject import dcObject
class dcCursor(dcObject):
"""The base Cursor Class"""
def OpenCursor(tcTemp,tcTable):
"""Opens the specified cursor
Parameters: tcTemp,tcTable"""
pass
def CreateCursor(tcTable):
"""Creates the specified cursor
Parameters: tcTable"""
pass
def init_Exec():
print("init_Exec called")
# -*- coding: utf-8 -*-
# dcObject.py - Base Object
class dcObject(object):
"""Base Object"""
def __init__():
"""default init method has the form
of init_Pre() and init_Exec
init_Post()"""
self.init_Pre() and self.init_Exec()
self.init_Post()
def init_Pre():
"""Always called before init_Exec()
if it returns false init_Exec is
not executed"""
return True
def init_Exec():
"""Base __init__ code goes here and this is
only executed if init_Pre() returns true"""
return True
def init_Post():
"""Always called after the init_Pre() and
init_Exec()"""
return True
I want to create an instance of dcCursor which inherits from
dcObject. When I run the following code it gives the error shown.
Can some explain to me what is wrong? I have included the dcObject.py
and dcCursor.py below.
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
TypeError: __init__() takes no arguments (1 given)
# -*- coding: utf-8 -*-
# dcCursor.py - The base Cursor Class
from dcObject import dcObject
class dcCursor(dcObject):
"""The base Cursor Class"""
def OpenCursor(tcTemp,tcTable):
"""Opens the specified cursor
Parameters: tcTemp,tcTable"""
pass
def CreateCursor(tcTable):
"""Creates the specified cursor
Parameters: tcTable"""
pass
def init_Exec():
print("init_Exec called")
# -*- coding: utf-8 -*-
# dcObject.py - Base Object
class dcObject(object):
"""Base Object"""
def __init__():
"""default init method has the form
of init_Pre() and init_Exec
init_Post()"""
self.init_Pre() and self.init_Exec()
self.init_Post()
def init_Pre():
"""Always called before init_Exec()
if it returns false init_Exec is
not executed"""
return True
def init_Exec():
"""Base __init__ code goes here and this is
only executed if init_Pre() returns true"""
return True
def init_Post():
"""Always called after the init_Pre() and
init_Exec()"""
return True