On 2012-12-13 18:58, Rob Richardson wrote:
Greetings!

I have finally gotten fed up with all of the Python scripts used in my
company that have every parameter hard-coded.  I am rewriting one of
them to read all of its parameters from an XML file.  Then, we can
change the XML file to control which database it is using, whether its
running in debug mode or not, and various other things.  One of the
parameters I want the XML file to contain is the name of the script's
log file.

I have a class named Settings that will contain all the parameters read
from the XML file.  But if something goes wrong, I want to log it.  So,
I want to have a Logger object for it to use.  I use a hard-coded file
name for that.  Then, after reading the XML file, I want to create a
second Logger object that will be used by the rest of the script.

When I try to use the second Logger object, I get an exception
complaining that 'unicode' object has no attribute 'write'.

The script and the exception messages are below.  Can anyone see what
I'm doing wrong?

[snip]
I think the problem might be that it's expecting a file object, not a
file name/path as you have here:

    TempLogger.set_target("TaskToCrane_logging_base.log")

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to