简体   繁体   English

Sphinx 文档在本地有效,但不能在阅读文档时使用

[英]Sphinx documentation locally works, but not on read the docs

I started with writing my documentation for my lil' python/django project.我开始为我的小 python/django 项目编写文档。

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.但是:我所有的文件都是用 UTF-8 编码的。 AND it works locally (windows).并且它在本地工作(Windows)。

This is my modules/booking.rst .这是我的模块/booking.rst And in this directory are my booking-module-files . 在这个目录中是我的 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.PEP 0263 所述,将其添加到源文件的顶部可确保它与 utf-8 编码一起正常工作。

#!/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 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM