sphinx unicode decode error when reading getopt.rst from a local copy of the Python 2.7.1 standard library?

lac avatarlac created an issue

This error I got from sphinx looks insane to me. I ran sphinx-quickstart in the wrong place (my home directory) and thus it happily went and found a local copy pypy has of the 2.7.1 Docs. Then it gave me a unicode decode error.

Here is what happened.

lac@smartwheels:$ make html sphinx-build -b html -d _build/doctrees . _build/html Running Sphinx v1.0.7 loading pickled environment... not yet created loading intersphinx inventory from http://docs.python.org/objects.inv... building [html]: targets for 1307 source files that are out of date updating environment: 1307 added, 0 changed, 0 removed reading sources... [ 0%] oejskit/laura-talk/vpython/lib/python2.6/site-packages

<more reading sources lines skipped>

reading sources... [ 18%] pypy/Python/Python-2.7.1/Doc/library/getopt Exception occurred: File "/usr/local/lib/python2.6/dist-packages/sphinx/ext/viewcode.py", line 34, in has_tag entry = analyzer.code.decode(analyzer.encoding), analyzer.tags, {} UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 858: ordinal not in range(128) The full traceback has been saved in /tmp/sphinx-err-3RcJNF.log, if you want to report the issue to the developers. Please also report this if it was a user error, so that a better error message can be provided next time. Either send bugs to the mailing list at <http://groups.google.com/group/sphinx-dev/>, or report them in the tracker at <http://bitbucket.org/birkenfeld/sphinx/issues/>. Thanks! make: * [html] Error 1

lac@smartwheels:more /tmp/sphinx-err-3RcJNF.log

  1. Sphinx version: 1.0.7
  2. Python version: 2.6.6
  3. Docutils version: 0.7 release
  4. Jinja2 version: 2.5.5 Traceback (most recent call last): File "/usr/local/lib/python2.6/dist-packages/sphinx/cmdline.py", line 188, in main app.build(force_all, filenames) File "/usr/local/lib/python2.6/dist-packages/sphinx/application.py", line 207, in build self.builder.build_update() File "/usr/local/lib/python2.6/dist-packages/sphinx/builders/init.py", lin e 198, in build_update 'out of date' % len(to_build)) File "/usr/local/lib/python2.6/dist-packages/sphinx/builders/init.py", lin e 218, in build purple, length): File "/usr/local/lib/python2.6/dist-packages/sphinx/builders/init.py", lin e 120, in status_iterator for item in iterable: File "/usr/local/lib/python2.6/dist-packages/sphinx/environment.py", line 519, in update_generator self.read_doc(docname, app=app) File "/usr/local/lib/python2.6/dist-packages/sphinx/environment.py", line 685, in read_doc app.emit('doctree-read', doctree) File "/usr/local/lib/python2.6/dist-packages/sphinx/application.py", line 317, in emit results.append(callback(self, *args)) File "/usr/local/lib/python2.6/dist-packages/sphinx/ext/viewcode.py", line 54, in doctree_read if not has_tag(modname, fullname, env.docname): File "/usr/local/lib/python2.6/dist-packages/sphinx/ext/viewcode.py", line 34, in has_tag entry = analyzer.code.decode(analyzer.encoding), analyzer.tags, {} UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 858: ordinal not in range(128)

....

I would have expected to find something written in latin-1 with no encoding. But I couldn't find a thing there. It looks just the same as a different copy of 2.7.1 standard library which I pulled down in order to run cmp on them. So I am puzzled now.

Laura Creighton

Comments (2)

  1. Georg Brandl
    • changed status to open

    Well, if you do "import getopt" in your Python 2.6, you will get the 2.6 getopt, which is in latin-1 and includes a Å.

    Now why the module coding cookie isn't read correctly, this is a bug in viewcode and I'll push a fix soon.

  2. 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.