Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > How do I get curses to work in Python 3.2 on win-64?

Reply
Thread Tools

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

 
 
Jan Sundström
Guest
Posts: n/a
 
      10-15-2011
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

 
Reply With Quote
 
 
 
 
Christoph Gohlke
Guest
Posts: n/a
 
      10-16-2011
On Oct 15, 1:13*pm, Jan Sundström <(E-Mail Removed)> 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.
 
Reply With Quote
 
 
 
 
Jan Sundström
Guest
Posts: n/a
 
      10-16-2011
On 16 Okt, 06:59, Christoph Gohlke <(E-Mail Removed)> wrote:
> On Oct 15, 1:13*pm, Jan Sundström <(E-Mail Removed)> 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?

 
Reply With Quote
 
Brian Curtin
Guest
Posts: n/a
 
      10-17-2011
On Sun, Oct 16, 2011 at 11:16, Jan Sundström <(E-Mail Removed)> wrote:
> On 16 Okt, 06:59, Christoph Gohlke <(E-Mail Removed)> wrote:
>> On Oct 15, 1:13*pm, Jan Sundström <(E-Mail Removed)> 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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Moving subwindows in curses does not seem to work Mitko Haralanov Python 0 10-15-2009 06:34 PM
How to get terminal dimensions without using curses or ncurses? Kenneth McDonald Ruby 8 09-26-2008 03:49 PM
Re: Replacing curses (Was: Re: Problem with curses and UTF-8) Jean-Paul Calderone Python 2 02-09-2006 08:29 AM
Can't get curses to work in python Scott Chapman Python 0 10-08-2004 03:48 PM



Advertisments