Writing to a Log - Error: Bound Method

Any help is appreciated. I was able to get it to print to the log, but I received the bound method error. I think it has something to do with my + str in my exception handling

def main():
“”“This function controls the main thread of the program.”""
print(‘Please enter a floating point value’)
response = input()
try:
max_counter = int(response)
except ValueError:
error_message()
else:
if max_counter <= 0:
error_message()
else:
Leibniz_object = MarshallHomework6.Pi_LeibnizClass(10)
#Collect the number from the user to use for the radius
print (‘Please enter your radius number: ‘)
response = input()
try:
max_counter = float(response)
except ValueError:
print(‘You have entered an invalid value. You must enter a positive floating point value or an integer.’)
print (‘Please restart the program and try again.’)
else:
Leibniz_object = MarshallHomework6.Pi_LeibnizClass(10)
logging.basicConfig(filename=‘example.log’,
format=’%(asctime)s %(levelname)s: %(message)s’,
level=logging.INFO)
msg1 = 'The circumference of circle is: ’ + str(Leibniz_object.get_circumference)
logging.info(msg1)
msg2 = 'The area of a circle is: ’ + str(Leibniz_object.get_area)
logging.info(msg2)
msg3 = 'The volume of a circle is: ’ + str(Leibniz_object.get_volume)
logging.info(msg3)
msg4 = 'The surface area of a circle is: ’ + str(Leibniz_object.get_surfacearea)
logging.info(msg4)
ending()

The question doesn’t seem to be PyTorch-related so e.g. StackOverflow might be a better place to ask these Python questions in order to get a faster response. :wink:
Also, your code formatting is unfortunately still not working (click on the “Preformatted text” button to add code snippets).

1 Like

This is Python. I’m coding in Python.

thanks for the help.

Yes, I see that you are using Python, but this discussion forum is specialized on PyTorch (the ML framework). While we can certainly try to help solving plain Python issues, the majority of the discussion is focused on PyTorch, which is why I suggested other boards for a faster response :wink: