Error on latex output

Anonymous avatarAnonymous created an issue

When I use: sphinx-build -b latex doc/ doc/_build/ raise an exception: Exception occurred: File "/usr/lib/python2.7/site-packages/sphinx/writers/latex.py", line 193, in init babel = ExtBabel(builder.config.language) TypeError: init() takes exactly 3 arguments (2 given)

Works fine for html or devhelp outputs.

Comments (5)

  1. Anonymous

    Sphinx log:

    1. Sphinx version: 1.0.7
    2. Python version: 2.7.1
    3. Docutils version: 0.8 repository
    4. Jinja2 version: 2.5.5 Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/sphinx/cmdline.py", line 188, in main app.build(force_all, filenames) File "/usr/lib/python2.7/site-packages/sphinx/application.py", line 207, in build self.builder.build_update() File "/usr/lib/python2.7/site-packages/sphinx/builders/init.py", line 193, in build_update self.build(['all'], to_build) File "/usr/lib/python2.7/site-packages/sphinx/builders/init.py", line 254, in build self.write(docnames, list(updated_docnames), method) File "/usr/lib/python2.7/site-packages/sphinx/builders/latex.py", line 104, in write docwriter.write(doctree, destination) File "/usr/lib/python2.7/site-packages/docutils/writers/init.py", line 77, in write self.translate() File "/usr/lib/python2.7/site-packages/sphinx/writers/latex.py", line 91, in translate visitor = LaTeXTranslator(self.document, self.builder) File "/usr/lib/python2.7/site-packages/sphinx/writers/latex.py", line 193, in init babel = ExtBabel(builder.config.language) TypeError: init() takes exactly 3 arguments (2 given)
  2. Anonymous

    This error occured when option language is set to any value. If I remove or comment this option, then PDF or latex output works again.

  3. engelbert gruber

    possible fix

     --- a/sphinx/writers/latex.py	Thu Jul 14 16:57:01 2011 +0200
    +++ b/sphinx/writers/latex.py	Fri Jul 22 11:20:18 2011 +0200
    @@ -97,6 +97,9 @@
    
    --- a/sphinx/writers/latex.py	Thu Jul 14 16:57:01 2011 +0200
    +++ b/sphinx/writers/latex.py	Fri Jul 22 11:43:29 2011 +0200
    @@ -95,8 +95,18 @@
     
     
     # Helper classes
    +class Reporter:
    +    """Miniature docutils reporter dummy for class Babel."""
    +    def warning(self, msg):
    +        sys.stderr.write(msg)
     
     class ExtBabel(Babel):
    +    def __init__(self, language_code):
    +        try:
    +            Babel.__init__(self, language_code)
    +        except TypeError:
    +            Babel.__init__(self, language_code, Reporter())
    +
         def get_shorthandoff(self):
             shortlang = self.language.split('_')[0]
             if shortlang in ('de', 'sl', 'pt', 'es', 'nl', 'pl', 'it'):
    
    
    

    and

    
    --- docutils/writers/latex2e/__init__.py	(revision 7097)
    +++ docutils/writers/latex2e/__init__.py	(working copy)
    @@ -411,8 +411,11 @@
                     t += self.next_quote() + part
             return t
     
    -    def get_language(self, language_code):
    -        """Return TeX language name for `language_code`"""
    +    def get_language(self, language_code=None):
    +        """Return TeX language name for `language_code`
    +        else the language name from initialization."""
    +        if not language_code:
    +            return self.language
             for tag in utils.normalize_language_tag(language_code):
                 try:
                     language = self.language_codes[tag]
    
    
    
  4. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.