首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >rst2html.py打印“在文件对象析构函数中关闭失败”

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

Stack Overflow用户
提问于 2014-03-22 12:57:16
回答 2查看 710关注 0票数 2

我编写了这个命令来检查setup.py中的长描述。

代码语言:javascript
复制
python setup.py --long-description | rst2html.py > output.html

但它会打印这条信息。

代码语言:javascript
复制
close failed in file object destructor:
sys.excepthook is missing
lost sys.stderr

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

我的环境是windows上的Python2.7.5。

请给我建议。

setup.py

代码语言:javascript
复制
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"
        ]
)
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2014-03-23 02:04:17

这个问题是通过

代码语言:javascript
复制
<Path to setup.py> pip install docutils

不会出现错误。

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

票数 0
EN

Stack Overflow用户

发布于 2014-03-22 13:46:10

您的setup.py中缺少一个逗号

代码语言:javascript
复制
    url = "test.com"
    packages = ["test"],

应该是

代码语言:javascript
复制
    url = "test.com",
    packages = ["test"],

此外,您的描述是缩进的,这破坏了rst。要么使用textwrap.dedent,要么不要缩进它,如下所示:

代码语言:javascript
复制
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"
    ]
)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22577902

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档