On Wed, Aug 31, 2011 at 3:38 PM, Aivar <[email protected]> wrote: > Hi! > > In some cases, when I make syntax mistake in reST source and when > there is a non-ascii character around, I get stacktrace instead of > helpful message telling me where is the mistake. It's quite hard to > track down such mistakes. > > One example is when I forget empty line after directive, for example: > > .. sourcecode:: python > for i in range(a,b): > # käsud > > > Another example: too short section underline: > > Lisanäited > ------ > > I'm not sure if this is problem in Sphinx or in docutils, can't tell > from the stacktrace: > Warning, treated as error: > Traceback (most recent call last): > File "c:\python27\scripts\sphinx-build-script.py", line 8, in > <module> > load_entry_point('Sphinx==1.0.7', 'console_scripts', 'sphinx- > build')() > File "c:\python27\lib\site-packages\sphinx-1.0.7-py2.7.egg\sphinx > \__init__.py" > , line 67, in main > return cmdline.main(argv) > File "c:\python27\lib\site-packages\sphinx-1.0.7-py2.7.egg\sphinx > \cmdline.py", > line 212, in main > print >>error, err > UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in > position 202 > : ordinal not in range(128) > > best regards, > Aivar
In the example you are giving the message at the and of the trace is telling you exactly what the problem is: you included some non-ASCII character in a plain ASCII file. But this is not a Sphinx-specific issue. This is a general Python issue. This is not a bug in Sphinx (or Python): if you give as input a file with non-ASCII characters the correct behaviour is to raise an exception, as is the case here. A simple solution is to change the encoding of you Python sources from ASCII to Unicode by adding the following as the first line in your Python file: # -*- coding: UTF-8 -*- > > -- > You received this message because you are subscribed to the Google Groups > "sphinx-dev" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/sphinx-dev?hl=en. > > -- Ernesto Posse Modelling and Analysis in Software Engineering School of Computing Queen's University - Kingston, Ontario, Canada -- You received this message because you are subscribed to the Google Groups "sphinx-dev" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sphinx-dev?hl=en.
