Logging module is causing Sphinx to crash.

216 views
Skip to first unread message

Piotrek Byzia

unread,
May 13, 2009, 10:54:09 AM5/13/09
to sphinx-dev
Hi everybody,

I'm having some problem due to the way I use logging module.
Basically, I have separate file with configuration for logging and in
each of my modules I define:

logging.config.fileConfig(os.getcwd() + "/log/logconf.ini")

and this is where Sphinx stops:

Exception occurred:[ 33%]
developer_guide
File "/Library/Frameworks/Python.framework/Versions/4.0.30002/lib/
python2.5/ConfigParser.py", line 511, in get
raise NoSectionError(section)
NoSectionError: No section: 'formatters'

Also, in my logcong.ini (config file for logging) I have:

[handler_filelog]
class: FileHandler
level=DEBUG
formatter: detailed
args=('/Users/piotr/Projects/Thesis/Autumn/SKM-latest/log/
warnings_errors.log', 'a')

where I want to provide a relative path but because of the same error
from Sphinx as above I'm forced to provide an absolute path to log
file.

Is there something I'm doing wrong?
How could I retain relative paths in my modules and logging config
files?


Any help greatly appreciated!
Thanks for the great work put on Sphinx, as your website says: “Cheers
for a great tool that actually makes programmers want to write
documentation!”

Piotrek Byzia

Wojtek Walczak

unread,
May 14, 2009, 4:08:21 PM5/14/09
to sphin...@googlegroups.com
Piotrek Byzia napisał(a):

Hello,

> logging.config.fileConfig(os.getcwd() + "/log/logconf.ini")
>
> and this is where Sphinx stops:
>
> Exception occurred:[ 33%]
> developer_guide
> File "/Library/Frameworks/Python.framework/Versions/4.0.30002/lib/
> python2.5/ConfigParser.py", line 511, in get
> raise NoSectionError(section)
> NoSectionError: No section: 'formatters'

This error happens when fileConfig can't find ini file.
Make sure that 'os.getcwd() + "/log/logconf.ini"' really
exists.

HTH,
--
Regards,
Wojtek Walczak,
http://tosh.pl/gminick/

Piotrek Byzia

unread,
May 15, 2009, 5:30:03 AM5/15/09
to sphinx-dev
On May 14, 9:08 pm, Wojtek Walczak <gmin...@tosh.pl> wrote:
> Piotrek Byzia napisał(a):
>
> Hello,
>
> > logging.config.fileConfig(os.getcwd() + "/log/logconf.ini")
>
> > and this is where Sphinx stops:
>
> > Exception occurred:[ 33%]
> > developer_guide
> >   File "/Library/Frameworks/Python.framework/Versions/4.0.30002/lib/
> > python2.5/ConfigParser.py", line 511, in get
> >     raise NoSectionError(section)
> > NoSectionError: No section: 'formatters'
>
> This error happens when fileConfig can't find ini file.
> Make sure that 'os.getcwd() + "/log/logconf.ini"' really
> exists.

Thanks for the tip.
Yes, this log file really exists and it's working as expected.
Problem is showing up only when I want to build documentation with
Sphinx :(

BTW, good luck with your GSOC project, Wojtek!

Cheers,
Piotrek

Wojtek Walczak

unread,
May 16, 2009, 2:43:56 AM5/16/09
to sphin...@googlegroups.com
Piotrek Byzia napisał(a):

Hi,

>>> logging.config.fileConfig(os.getcwd() + "/log/logconf.ini")
...


>>> NoSectionError: No section: 'formatters'
>> This error happens when fileConfig can't find ini file.
>> Make sure that 'os.getcwd() + "/log/logconf.ini"' really
>> exists.

...


> Yes, this log file really exists and it's working as expected.
> Problem is showing up only when I want to build documentation with
> Sphinx :(

I believe that the file exists and that there is no syntax errors
in this file. My point is that: what if Sphinx is changing
the current working directory to one of its subdirectories
before running this:
logging.config.fileConfig(os.getcwd() + "/log/logconf.ini")
...and in result the path you are providing is not correct.
What about printing the path right before using fileConfig
to make sure that it's correct?


> BTW, good luck with your GSOC project, Wojtek!

Thanks, a bit of luck might help, really :)

Reply all
Reply to author
Forward
0 new messages