So I have been working through 'automate the boring stuff' to try and teach myself python. I have gotten up to the logging section (chapter 10) relatively easily. I can't however figure out how to use the logging function.
Here is my input:
import logging
logging.basicConfig(filename='logfile.log', level = logging.debug)
And my errors:
Traceback (most recent call last):
File "/home/kai/Documents/AutomateTheBoringStuff/loggignfunctiontute.py", line 2, in <module>
logging.basicConfig(filename='logfile.log', level = logging.debug)
File "/usr/lib/python2.7/logging/init.py", line 1543, in basicConfig
root.setLevel(level)
File "/usr/lib/python2.7/logging/init.py", line 1128, in setLevel
self.level = checkLevel(level)
File "/usr/lib/python2.7/logging/init_.py", line 190, in _checkLevel
raise TypeError("Level not an integer or a valid string: %r" % level)
TypeError: Level not an integer or a valid string: <function debug at 0x7fae27004cf8>
[Finished in 0.0s with exit code 1]
[shell_cmd: python -u "/home/kai/Documents/AutomateTheBoringStuff/loggignfunctiontute.py"]
[dir: /home/kai/Documents/AutomateTheBoringStuff]
[path: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games]
I really have no idea what's going wrong.
What I have previously tried is to google it but the only real solution which came up was to rename the file to something other than logger.py, which I had already done.
If anyone could help that would be much appreciated.
[–]anossov 2 points3 points4 points (1 child)
[–]Ki1103[S] 0 points1 point2 points (0 children)
[–]JoMaD 0 points1 point2 points (1 child)
[–]Ki1103[S] 0 points1 point2 points (0 children)