AttributeError: 'int' object has no attribute 'replace' when building traits document

Issue #2 invalid
Takafumi Arakaki
created an issue

When I try to build texinfo document of traits (, I got the following traceback


Sphinx version: 1.2pre/51850bb9b7a1

Python version: 2.7.2+

Docutils version: 0.9.1 release

Jinja2 version: 2.6

Traceback (most recent call last): File "/home/takafumi/repos/watch/sphinx-info/sphinx/", line 190, in main, filenames) File "/home/takafumi/repos/watch/sphinx-info/sphinx/", line 204, in build self.builder.build_update() File "/home/takafumi/repos/watch/sphinx-info/sphinx/builders/", line 191, in build_update['all'], to_build) File "/home/takafumi/repos/watch/sphinx-info/sphinx/builders/", line 252, in build self.write(docnames, list(updated_docnames), method) File "/home/takafumi/repos/watch/sphinx-info/sphinx/builders/", line 160, in write docwriter.write(doctree, destination) File "/home/takafumi/.virtualenvs/mypy/local/lib/python2.7/site-packages/docutils/writers/", line 77, in write self.translate() File "/home/takafumi/repos/watch/sphinx-info/sphinx/writers/", line 112, in translate self.visitor = visitor = TexinfoTranslator(self.document, self.builder) File "/home/takafumi/repos/watch/sphinx-info/sphinx/writers/", line 141, in init self.init_settings() File "/home/takafumi/repos/watch/sphinx-info/sphinx/writers/", line 227, in init_settings self.escape_id(settings.texinfo_dir_category), entry) File "/home/takafumi/repos/watch/sphinx-info/sphinx/writers/", line 345, in escape_id s = s.replace(bc, ' ') AttributeError: 'int' object has no attribute 'replace' }}}

I can reproduce the error by something like this:

{{{ git clone -b texinfo git:// cd traits python build cd docs PYTHONPATH=../build/lib.linux-x86_64-2.7/ make info SPHINXBUILD=~/repos/watch/sphinx-info/ texinfo }}}

Comments (5)

  1. Jon Waltman repo owner

    I checked out the and I think you have a couple of the fields out of place in texinfo_documents.

    texinfo_documents = [
      (master_doc, 'traits', 'Traits 4 User Manual',
       'Enthought, Inc.',
       'Traits', 'explicitly typed attributes for Python',

    The seventh field should be a string indicating the category to use in the dir file. I think you meant for the 1 to be the eighth field which makes Sphinx ignore everything in the master document except the toctree. (See texinfo_documents)

    I added a category and it eliminated the problem. I also tried building the docs with the eighth field both true and false and I think it produces a better layout of the chapters when it is set to false.

    What category do you want to use? I would like to have a standard category to use for different Python packages. The Texinfo manual recommends consulting the Free Software Directory (; there is also a list of categories at ( I'm leaning towards "Python". What do you think?


    Edit: Also, your code in the traits/docs/source/Makefile puts the texinfo/info docs in a different directory than the other formats (_build instead of build).

  2. Log in to comment