0

I've generated an exe file with the cx_Freeze utility from the following python script:

from curses import wrapper

def main(stdscr):
    pass

wrapper(main)

But when I'm running it, it gives me an error:

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

Full error:

Error message

The thing is that the exe works without errors when I'm excluding wrapper(main) from the script.

jpeg
  • 2,372
  • 4
  • 18
  • 31
Alderven
  • 7,569
  • 5
  • 26
  • 38
  • sounds like a limitation of cx_freeze (`fileno` is a standard C runtime function). – Thomas Dickey Feb 28 '19 at 23:12
  • Could you please share your setup script? On which (Windows) platform do you work, how did you get `curses` to work on it (the `curses` module included in the standard Python installation does not work on Windows 7). – jpeg Mar 01 '19 at 07:26

1 Answers1

0

I can produce a working executable from your curses_example.py python script using python 3.6 and cx_Freeze 5.1.1 on Windows 7 with the following setup script:

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)

To get curses to work, I first needed to install windows-curses using

pip install windows-curses

following a hint from ImportError: No module named '_curses' when trying to import blessings.

jpeg
  • 2,372
  • 4
  • 18
  • 31