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

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

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

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

--
http://mail.python.org/mailman/listinfo/python-list
Reply | Threaded
Open this post in threaded view
|

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

cjgohlke
On Oct 15, 1:13 pm, Jan Sundström <[hidden email]> wrote:

> 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.
--
http://mail.python.org/mailman/listinfo/python-list
Reply | Threaded
Open this post in threaded view
|

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

Jan Sundström
On 16 Okt, 06:59, Christoph Gohlke <[hidden email]> wrote:

> On Oct 15, 1:13 pm, Jan Sundström <[hidden email]> wrote:
>
>
>
> `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?

--
http://mail.python.org/mailman/listinfo/python-list
Reply | Threaded
Open this post in threaded view
|

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

briancurtin
On Sun, Oct 16, 2011 at 11:16, Jan Sundström <[hidden email]> wrote:

> On 16 Okt, 06:59, Christoph Gohlke <[hidden email]> wrote:
>> On Oct 15, 1:13 pm, Jan Sundström <[hidden email]> wrote:
>>
>>
>>
>> `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?

It's not a standard library module on Windows. The curses Christoph
mentioned is built on the PDCurses library, which is an external
project.
--
http://mail.python.org/mailman/listinfo/python-list