How do I get curses to work in Python 3.2 on win-64?

J

Jan Sundström

How do I get curses to work in Python 3.2 on win-64?

I'm new to Python and when exploring Python in console I want to use
some
simple functions for console programming that don't emulate a
typewriter
terminal but rather a text screen terminal. I want to be able to clear
the screen, position the cursor
and do unbuffered reading from the keyboard. Also setting different
colors for the text and background.

That could in Windows be accomplished by the handy WConio (http://
newcenturycomputers.net/projects/wconio.html)
which contains just about everything that is needed for a console
application to become useful.

However I want to accomplish it in Python 3.2 because I lack the
experience to build it myself. Now an alternative would
be to use some flavor of curses. Although having a plethora of
unnecessary functions it has the advantage of
existing for different platforms.

I'm currently running Python 3.2.2 on win-64
When Python is installed there is a Python32/Lib/curses library. As I
understand it this is only a some sort of
wrapper for a curses module to be downloaded and installed later??

So I downloaded and installed a curses module I that found and which
seemed appropriate:

curses-2.2.win-amd64-py3.2.exe

from

http://www.lfd.uci.edu/~gohlke/pythonlibs/

It installed some stuff directly in Python32/lib/sitepackages.


Now when I try in a program to do things like:

import curses
stdscr = curses.initscr

Python complains it can't find curses. However if I do

import _curses
stdscr = _curses.initscr

etc., everything works fine. I shouldn't have to write the underscores
though??
How can I fix that?
Should I try to find some other version of curses?

It seems I haven't yet grasped how to install a Python module?

/John
 
C

Christoph Gohlke

How do I get curses to work in Python 3.2 on win-64?

I'm new to Python and when exploring Python in console I want to use
some
simple functions for console programming that don't emulate a
typewriter
terminal but rather a text screen terminal. I want to be able to clear
the screen, position the cursor
and do unbuffered reading from the keyboard. Also setting different
colors for the text and background.

That could in Windows be accomplished by the handy WConio (http://
newcenturycomputers.net/projects/wconio.html)
which contains just about everything that is needed for a console
application to become useful.

However I want to accomplish it in Python 3.2 because I lack the
experience to build it myself. Now an alternative would
be to use some flavor of curses. Although having a plethora of
unnecessary functions it has the advantage of
existing for different platforms.

I'm currently running Python 3.2.2 on win-64
When Python is installed there is a Python32/Lib/curses library. As I
understand it this is only a some sort of
wrapper for a curses module to be downloaded and installed later??

So I downloaded and installed a curses module I that found and which
seemed appropriate:

curses-2.2.win-amd64-py3.2.exe

from

http://www.lfd.uci.edu/~gohlke/pythonlibs/

It installed some stuff directly in Python32/lib/sitepackages.

Now when I try in a program to do things like:

import curses
stdscr = curses.initscr

Python complains it can't find curses. However if I do

import _curses
stdscr = _curses.initscr

etc., everything works fine. I shouldn't have to write the underscores
though??
How can I fix that?
Should I try to find some other version of curses?

It seems I haven't yet grasped how to install a Python module?

/John

`import curses` should work. What exactly is the error message? Does
`import curses` work outside your program/program directory?

The curses package is part of the standard library and usually
installed in Python32\Lib\curses. On Windows the _curses.pyd files is
missing in the standard distribution. curses-2.2.win-amd64-py3.2.exe
installs the missing _curses.pyd file into Lib/site-packages.
 
J

Jan Sundström

`import curses` should work. What exactly is the error message? Does
`import curses` work outside your program/program directory?

The curses package is part of the standard library and usually
installed in Python32\Lib\curses. On Windows the  _curses.pyd files is
missing in the standard distribution. curses-2.2.win-amd64-py3.2.exe
installs the missing _curses.pyd file into Lib/site-packages.

Thanks for the tip to check in what library it works, that set me on
track tofind a silly mistake that I had done. Now everything works
fine.

But, how come that the Windows distribution for Python doesn't include
the _curses.pyd file?
 
B

Brian Curtin

Thanks for the tip to check in what library it works, that set me on
track tofind a silly mistake that I had done. Now everything works
fine.

But, how come that the Windows distribution for Python doesn't include
the _curses.pyd file?

It's not a standard library module on Windows. The curses Christoph
mentioned is built on the PDCurses library, which is an external
project.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top