[Tutor] Error Using Logging Module

Alan Gauld alan.gauld at btinternet.com
Sun Sep 30 01:03:22 CEST 2007


"James" <jtp at nc.rr.com> wrote

> I'm having some trouble using the Python logging module.  Here's the
> snippet of code that's causing problems:
>
> --------
>
> # setting up logging using Python's logging module
> LOGFILE = "/home/james/log"
> logging.basicConfig( level=logging.DEBUG,
> format='%(asctime)s <> %(levelname)s <> %(message)s',
> datefmt='%a, %d %b %Y %H:%M:%S',
> filename=LOGFILE,
> filemode='w')
>
> --------
>
> When I run the program, I get this error:
>
> --------
>
>
> Traceback (most recent call last):
>   File "./script.py", line 225, in <module>
>     sys.exit( main() )

I don't see how it would cause your problems but it's the only
strange thing I can see in the traceback, so, in the interests of
minimising the variables, can you change the code to call
main() outside of sys.exit? Does that change anything?

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 




More information about the Tutor mailing list