Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: No module named '_curses' when trying to import blessings

I am trying to run this:

from blessings import Terminal

t = Terminal()

print (t.bold('Hi there!'))
print (t.bold_red_on_bright_green('It hurts my eyes!'))

with t.location(0, t.height - 1):
    print ('This is at the bottom.')

Which is the first example here: https://pypi.python.org/pypi/blessings.

However, I get this error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\�����\AppData\Local\Programs\Python\Python35-     32\lib\site-packages\blessings\__init__.py", line 5, in <module>
    import curses
  File "C:\Users\�����\AppData\Local\Programs\Python\Python35-32\lib\curses\__init__.py", line 13, in <module>
    from _curses import *
ImportError: No module named '_curses'

My system is win10 x64.

like image 978
Nazarii Morhun Avatar asked Mar 07 '16 17:03

Nazarii Morhun


3 Answers

Meanwhile - Python 2.7.15 on Windows 10 - curses support can be added by:

pip install windows-curses
like image 161
Bruno Ranieri Avatar answered Oct 19 '22 15:10

Bruno Ranieri


The curses module is not supported on Windows machines. From the module documentation:

While curses is most widely used in the Unix environment, versions are available for DOS, OS/2, and possibly other systems as well. This extension module is designed to match the API of ncurses, an open-source curses library hosted on Linux and the BSD variants of Unix.

Install the unofficial windows binary for curses from here and try again.

like image 33
Forge Avatar answered Oct 19 '22 16:10

Forge


All you need is just download the library

pip install windows-curses
like image 6
Mohamed Medhat Avatar answered Oct 19 '22 16:10

Mohamed Medhat