cx_Freeze + curses:'NoneType'对象没有属性'fileno'

问题描述 投票:0回答:1

我使用以下python脚本中的exe实用程序生成了一个cx_Freeze文件:

from curses import wrapper

def main(stdscr):
    pass

wrapper(main)

但是当我运行它时,它给了我一个错误:

AttributeError: 'NoneType' object has no attribute 'fileno'

完整错误:

Error message

问题是,当我从脚本中排除wrapper(main)时,exe工作没有错误。

python cx-freeze curses
1个回答
0
投票

我可以使用以下安装脚本在Windows 7上使用python 3.6和curses_example.py 5.1.1从cx_Freeze python脚本生成可运行的可执行文件:

from cx_Freeze import setup, Executable

executables = [Executable('curses_example.py')]

setup(name='curses_example',
      version='0.1',
      description='Sample cx_Freeze script',
      executables=executables)

为了让curses工作,我首先需要安装windows-curses

pip install windows-curses

遵循ImportError: No module named '_curses' when trying to import blessings的提示。

© www.soinside.com 2019 - 2024. All rights reserved.