Search code examples
pythoncurses

Python Curses initscr Error


I'm trying to initiate

screen = curses.initscr()

But it failed and returns

File "C:\Python32\lib\curses\__init__.py", line 31, in initscr
fd=_sys.__stdout__.fileno())
AttributeError: 'NoneType' object has no attribute 'fileno'

Here's my system Python 3.2.3 (default, Apr 11 2012, 07:12:16) [MSC v.1500 64 bit (AMD64)] on win32

This is my first time running python on this computer, it's Windows 7 64bit.

Is this has something to do with my OS? Anyway I can solve this?


Solution

  • You can't use the curses module on Windows; apparently there are DOS and OS/2 ports but it is primarily a POSIX-only library.

    You'll have to use a Windows-specific port such as wcurses, a third-party project that supports Windows too such as PDCurses, or you could try the console module (the latter drives the Windows CMD console in a similar manner).