Hello,

I'm using the matplotlib Sphinx extension which automatically includes the
source
code and the figures it produces into the Sphinx document. This is a very
handy
feature whose use goes far beyond documenting matplotlib itself. (thanks for
that by the way)

However I have trouble when the python file passed to the plot directive
contains
non-ascii characters. I set up a simple example located there :
http://github.com/sbarthelemy/SphinxEncoding

running "make html" on it raises:
  Exception occurred:
    File "/usr/lib/pymodules/python2.6/sphinx/highlighting.py", line 167, in
highlight_block
      source = source.decode()
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 37:
ordinal not in range(128)
  The full traceback has been saved in /tmp/sphinx-err-5kW6ih.log, if you
want to report the issue to the author.

So, I've got a few questions:

- is this expected ?
- is there a workaround ?
- if not, how hard would it be to fix this problem, maybe I could help a bit
(with proper guidance).

Thank you for any help !

PS: I use sphinx 0.6.2-1 and matplotlib 0.99.0-1ubuntu1, both shipped from
ubuntu karmic
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/sphinx/cmdline.py", line 172, in main
    app.build(all_files, filenames)
  File "/usr/lib/pymodules/python2.6/sphinx/application.py", line 130, in build
    self.builder.build_update()
  File "/usr/lib/pymodules/python2.6/sphinx/builders/__init__.py", line 265, in build_update
    'out of date' % len(to_build))
  File "/usr/lib/pymodules/python2.6/sphinx/builders/__init__.py", line 320, in build
    self.write(docnames, list(updated_docnames), method)
  File "/usr/lib/pymodules/python2.6/sphinx/builders/__init__.py", line 359, in write
    self.write_doc(docname, doctree)
  File "/usr/lib/pymodules/python2.6/sphinx/builders/html.py", line 343, in write_doc
    self.docwriter.write(doctree, destination)
  File "/usr/lib/pymodules/python2.6/docutils/writers/__init__.py", line 76, in write
    self.translate()
  File "/usr/lib/pymodules/python2.6/sphinx/writers/html.py", line 37, in translate
    self.document.walkabout(visitor)
  File "/usr/lib/pymodules/python2.6/docutils/nodes.py", line 176, in walkabout
    if child.walkabout(visitor):
  File "/usr/lib/pymodules/python2.6/docutils/nodes.py", line 176, in walkabout
    if child.walkabout(visitor):
  File "/usr/lib/pymodules/python2.6/docutils/nodes.py", line 168, in walkabout
    visitor.dispatch_visit(self)
  File "/usr/lib/pymodules/python2.6/docutils/nodes.py", line 1535, in dispatch_visit
    return method(node)
  File "/usr/lib/pymodules/python2.6/sphinx/writers/html.py", line 222, in visit_literal_block
    lang, linenos)
  File "/usr/lib/pymodules/python2.6/sphinx/highlighting.py", line 167, in highlight_block
    source = source.decode()
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 37: ordinal not in range(128)
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to