I'm coming from a C/C++ world and am having a hard time making all of the OOP analogies in python. I wrapped my script in a class and now get this error in my log()
'private' instance method:
AttributeError: 'instancemethod' object has no attribute 'counter'
def __log(self, contents):
sys.stdout.write(contents)
# Append all writes after the first
if not hasattr(self.__log, "counter"):
self.__log.counter = 1
f = open(self.output_filepath, 'w')
else :
f = open(self.output_filepath, 'a')
f.write(contents)
f.close()