Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#12 crash with configuration file

closed-fixed
David Goodger
None
5
2006-12-09
2006-11-30
No

I downloaded a snapshot of docutils:

(Docutils 0.5 [snapshot 2006-11-29, r4819])

When I run rst2latex.py with a configuration file, python raises an error (below). My configuration file looks like this:

datestamp: %Y-%m-%d

Traceback (most recent call last):
File "/usr/bin/rst2latex.py", line 23, in ?
publish_cmdline(writer_name='latex', description=description)
File "/usr/lib/python2.4/site-packages/docutils/core.py", line 335, in publish_cmdline
config_section=config_section, enable_exit_status=enable_exit_status)
File "/usr/lib/python2.4/site-packages/docutils/core.py", line 197, in publish
self.process_command_line(
File "/usr/lib/python2.4/site-packages/docutils/core.py", line 149, in process_command_line
option_parser = self.setup_option_parser(
File "/usr/lib/python2.4/site-packages/docutils/core.py", line 112, in setup_option_parser
usage=usage, description=description)
File "/usr/lib/python2.4/site-packages/docutils/frontend.py", line 485, in __init__
config_settings = self.get_standard_config_settings()
File "/usr/lib/python2.4/site-packages/docutils/frontend.py", line 544, in get_standard_config_settings
settings.update(self.get_config_file_settings(filename), self)
File "/usr/lib/python2.4/site-packages/docutils/frontend.py", line 550, in get_config_file_settings
parser.read(config_file, self)
File "/usr/lib/python2.4/site-packages/docutils/frontend.py", line 656, in read
CP.ConfigParser.readfp(self, fp, filename)
File "/usr/lib/python2.4/ConfigParser.py", line 286, in readfp
self._read(fp, filename)
File "/usr/lib/python2.4/ConfigParser.py", line 462, in _read
raise MissingSectionHeaderError(fpname, lineno, line)
ConfigParser.MissingSectionHeaderError: File contains no section headers.
file: ./docutils.conf, line: 2
u'datestamp: %Y-%m-%d\n'

Discussion

  • David Goodger
    David Goodger
    2006-11-30

    • assigned_to: nobody --> goodger
     
  • David Goodger
    David Goodger
    2006-11-30

    Logged In: YES
    user_id=7733
    Originator: NO

    The end of the traceback pinpoints the problem:
    "ConfigParser.MissingSectionHeaderError: File contains no section headers".
    Just add a line with "[general]" to the beginning of your config file.
    See http://docutils.sourceforge.net/docs/user/config.html#configuration-file-syntax for details.

    However, Docutils could complain in a more user-friendly way. Will add.

     
  • Logged In: YES
    user_id=663081
    Originator: YES

    But I already looked at the link you provided, and it is not at all even close to clear. The link talks about a section header but gives no examples and does not even say what the section header is for. I don't mind the python crash so much (since I understand python) as much as I do the lack of clear direction on the configuration file.

    Thanks

     
  • David Goodger
    David Goodger
    2006-11-30

    Logged In: YES
    user_id=7733
    Originator: NO

    I will add a concrete example. I guess we assumed that .ini-style configuration files were so standard they didn't need explanation. There's a link to the docs of the ConfigParser.py module that has examples, but that may be too indirect.

    The first paragraph of the "Configuration File Sections & Entries" section explains what section headers are for.

     
  • David Goodger
    David Goodger
    2006-12-09

    • status: open --> closed-fixed
     
  • David Goodger
    David Goodger
    2006-12-09

    Logged In: YES
    user_id=7733
    Originator: NO

    added example section to docs/user/config.txt