2014-03-31 28 views
2

我開始爲我的lil'python/django項目編寫我的文檔。獅身人面像文件在本地工作,但不是在閱讀文檔

出現這種情況:

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) 

我明白了,這是一個編碼的問題。

但是:我所有的文件都是用UTF-8編碼的。它在本地工作(窗口)。

這是我的modules/booking.rst。和in this directory are my booking-module-files

任何幫助真的很感激!

回答

2

PEP 0263所述,將其添加到源文件的頂部可以確保它在utf-8編碼時正常工作。

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

當我在源文件中的字符串文字中有一些日文字符時,個人遇到了這個問題。

+0

好吧,這太瘋狂了。我將encoding = utf-8添加到所有文件,現在它可以工作。即使在這些文件中也沒有字符僅限於utf8。不過。謝謝! – tjati

相關問題