1. Jon Waltman
  2. sphinx-info
  3. Issues
Issue #2 invalid

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

Takafumi Arakaki
created an issue

When I try to build texinfo document of traits (https://github.com/enthought/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/cmdline.py", line 190, in main app.build(force_all, filenames) File "/home/takafumi/repos/watch/sphinx-info/sphinx/application.py", line 204, in build self.builder.build_update() File "/home/takafumi/repos/watch/sphinx-info/sphinx/builders/init.py", line 191, in build_update self.build(['all'], to_build) File "/home/takafumi/repos/watch/sphinx-info/sphinx/builders/init.py", line 252, in build self.write(docnames, list(updated_docnames), method) File "/home/takafumi/repos/watch/sphinx-info/sphinx/builders/texinfo.py", line 160, in write docwriter.write(doctree, destination) File "/home/takafumi/.virtualenvs/mypy/local/lib/python2.7/site-packages/docutils/writers/init.py", line 77, in write self.translate() File "/home/takafumi/repos/watch/sphinx-info/sphinx/writers/texinfo.py", line 112, in translate self.visitor = visitor = TexinfoTranslator(self.document, self.builder) File "/home/takafumi/repos/watch/sphinx-info/sphinx/writers/texinfo.py", line 141, in init self.init_settings() File "/home/takafumi/repos/watch/sphinx-info/sphinx/writers/texinfo.py", line 227, in init_settings self.escape_id(settings.texinfo_dir_category), entry) File "/home/takafumi/repos/watch/sphinx-info/sphinx/writers/texinfo.py", 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://github.com/tkf/traits.git cd traits python setup.py build cd docs PYTHONPATH=../build/lib.linux-x86_64-2.7/ make info SPHINXBUILD=~/repos/watch/sphinx-info/sphinx-build.py texinfo }}}

Comments (5)

  1. Jon Waltman repo owner

    I checked out the conf.py 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 (http://www.gnu.org/directory); there is also a list of categories at (http://www.gnu.org/manual/). 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