Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Logging: wrong WARNING logged
I am wondering why my code isn't working, how to do I pass this challenge?
import logging logging.basicConfig(filename='cc.log', level=logging.DEBUG) # Write your code below here logging.debug(print("hi")) logging.warning(print("The French have the Grail"))
Jennifer NordellTreehouse Teacher
Hi there, Riley Ittidecharchoti! You're really close, but you need to remove the
print() parts. The
print() function simply prints something, but it has no return value, so it returns
None which will then be cast to a string and recorded in the log file as "None", which isn't what you're wanting.
It would be similar to doing the following:
If you were to run that code, it would first print the word "Hi" to the console, then on a new line it would print the word "None" because you're telling it to print what was returned by the
So instead of:
logging.warning(print("The French have the Grail"))
You just need:
logging.warning("The French have the Grail")
Hope this helps!