如何修复导入PyRTF后无法识别的模块

2024-05-15 20:57:16 发布

您现在位置:Python中文网/ 问答频道 /正文

我对Python还不熟悉。我正在尝试运行PyRTF的this示例。我可以导入PyRTF(我已经安装了PyRTF3),但是我不能调用PyRTF中的任何模块,即Document()Renderer()。我在Python文件夹中找到了模块文件和PyRTF,所以我知道它们存在。你知道吗

我从examples2.py中的第48行得到错误消息:

if __name__ == '__main__' :
    DR = Renderer()

    doc1 = MakeExample1()

    DR.Write( doc1, OpenFile( 'Image1' ) )

    print("Finished")

NameError: name 'Renderer' is not defined

编辑:我发现这个模块只与Python2.7兼容,但他们还是把它推到了3.x版本。你知道吗


Tags: 模块文件namepy文件夹示例错误doc1