Issue #1512 resolved

csv-table directive can't handle non-ascii file path

Takayuki Shimizukawa
created an issue

This issue was posted to ML:

.. csv-table:: <non-ascii-path-to-csv-file>

This reST raise UnicodeDecodeError. The below path will correct this issue.

--- a/sphinx/     Fri Feb 07 13:35:54 2014 +0900
+++ b/sphinx/     Fri Feb 07 14:19:27 2014 +0900
@@ -753,7 +753,7 @@

     def process_dependencies(self, docname, doctree):
         """Process docutils-generated dependency info."""
-        cwd = os.getcwd()
+        cwd = os.getcwdu()
         frompath = path.join(path.normpath(self.srcdir), 'dummy')
         deps = doctree.settings.record_dependencies
         if not deps:

Comments (7)

  1. Takeshi Komiya

    I investigate about this problem, it is caused from current working directory, not path of csv file.

    In spite of the document does not include any non-ascii paths, this bug crashes sphinx-build if you invoke the command at non-ascii directory ::

    $ cd <non-ascii-directory>
    $ sphinx-build -E -T -b html -d ../doc/_build/doctrees  ../doc ../doc/_build/html
    Running Sphinx v1.2.2
    loading translations [ja]... done
    building [html]: targets for 4 source files that are out of date
    updating environment: 4 added, 0 changed, 0 removed
    ../doc/tox.inis... [ 25%] index
    Traceback (most recent call last):
      File "/Users/tkomiya/.buildout/buildout-eggs/Sphinx-1.2.2-py2.7.egg/sphinx/", line 254, in main, filenames)
      File "/Users/tkomiya/.buildout/buildout-eggs/Sphinx-1.2.2-py2.7.egg/sphinx/", line 212, in build
      File "/Users/tkomiya/.buildout/buildout-eggs/Sphinx-1.2.2-py2.7.egg/sphinx/builders/", line 214, in build_update
        'out of date' % len(to_build))
      File "/Users/tkomiya/.buildout/buildout-eggs/Sphinx-1.2.2-py2.7.egg/sphinx/builders/", line 234, in build
        purple, length):
      File "/Users/tkomiya/.buildout/buildout-eggs/Sphinx-1.2.2-py2.7.egg/sphinx/builders/", line 134, in status_iterator
        for item in iterable:
      File "/Users/tkomiya/.buildout/buildout-eggs/Sphinx-1.2.2-py2.7.egg/sphinx/", line 477, in update_generator
        self.read_doc(docname, app=app)
      File "/Users/tkomiya/.buildout/buildout-eggs/Sphinx-1.2.2-py2.7.egg/sphinx/", line 629, in read_doc
        self.process_dependencies(docname, doctree)
      File "/Users/tkomiya/.buildout/buildout-eggs/Sphinx-1.2.2-py2.7.egg/sphinx/", line 769, in process_dependencies
        path.normpath(path.join(cwd, dep)))
      File "/Users/tkomiya/.pyenv/versions/2.7.7/lib/python2.7/", line 80, in join
        path += '/' + b
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xe3 in position 24: ordinal not in range(128)
    Encoding error:
    'ascii' codec can't decode byte 0xe3 in position 24: ordinal not in range(128)
    The full traceback has been saved in /var/folders/2s/79pf79d94r9gxhzl4kpztrr00000gp/T/sphinx-err-jSa7gf.log, if you want to report the issue to the developers.
  2. Log in to comment