rst2html.py打印“文件对象析构函数中关闭失败”

时间:2014-03-22 12:57:16

标签: python

我编写此命令以检查setup.py中的长描述。

python setup.py --long-description | rst2html.py > output.html

但是它打印了这条消息。

close failed in file object destructor:
sys.excepthook is missing
lost sys.stderr

我打开output.html,但output.html是白皮书。

我的环境是Windows上的Python 2.7.5。

请告知。

setup.py

from distutils.core import setup

setup(
    name = "test", 
    version = "0.1",
    author = "test",
    author_email = "test@test.com",
    url = "test.com"
    packages = ["test"],
    license = "MIT License",
    description = "test",
    long_description = """
    ====
    test
    ====
    """,
    classifiers = [
        "Programming Language :: Python"
        ]
)

2 个答案:

答案 0 :(得分:0)

setup.py

中缺少逗号
    url = "test.com"
    packages = ["test"],

应该是

    url = "test.com",
    packages = ["test"],

此外,您的描述是缩进的,并且首先打破了。使用textwrap.dedent或不要缩进它,如下所示:

from distutils.core import setup

long_description = """
test
====

fooo
"""

setup(
    name="test",
    version="0.1",
    author="test",
    author_email="test@test.com",
    url="test.com",
    packages=["test"],
    license="MIT License",
    description="test",
    long_description=long_description,
    classifiers=[
        "Programming Language :: Python"
    ]
)

答案 1 :(得分:0)

解决了这个问题
<Path to setup.py> pip install docutils

它不会出现错误。

但是output.html仍然是白皮书。

相关问题