質問

I started with writing my documentation for my lil' python/django project.

This happens:

Running Sphinx v1.2
loading translations [en]... done
building [readthedocs]: targets for 18 source files that are out of date
updating environment: 18 added, 0 changed, 0 removed
reading sources... [  5%] administrator-guide/customizing
reading sources... [ 11%] administrator-guide/index
reading sources... [ 16%] developer-guide/index
reading sources... [ 22%] index
reading sources... [ 27%] modules/booking
Sphinx Standard Error
Sphinx error:
'ascii' codec can't decode byte 0xef in position 475: ordinal not in range(128)

I understand, this is an encoding problem.

But: all my files are encoded with UTF-8. AND it works locally (windows).

This is my modules/booking.rst. And in this directory are my booking-module-files.

Any help is really appreciated!

役に立ちましたか?

解決

As described by PEP 0263, adding this to the top of your source file ensures it works properly with utf-8 encoding.

#!/usr/bin/env python
# -*- coding: utf-8 -*-

Personally hit this snag when I had some Japanese characters in a string literal in a source file.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top