3

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?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Randize
  • 121
  • 1
  • 10

3 Answers3

1

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).

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
0

There are curses extension down-loads available for almost all the Python versions on Windows. I had the same error as Pieters but it stemmed from the fact I was trying to run the program from Idle. That doesn't work, apparently, when using an extension like curses. Just left click on your .py program and it will make its own call to Python and its extensions and this error goes away.

user3261738
  • 11
  • 1
  • 3
0

If you are using IDLE, you can't use curses. If you want curses with IDLE, start it with the following .bat file:

echo Waiting for starting program
python -m idlelib

It redirects curses to cmd window

szachy-a
  • 21
  • 5