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

Discussion in 'Python' started by Jan Sundström, Oct 15, 2011.

  1. 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
     
    Jan Sundström, Oct 15, 2011
    #1
    1. Advertising

  2. On Oct 15, 1:13 pm, Jan Sundström <> 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.
     
    Christoph Gohlke, Oct 16, 2011
    #2
    1. Advertising

  3. On 16 Okt, 06:59, Christoph Gohlke <> wrote:
    > On Oct 15, 1:13 pm, Jan Sundström <> 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?
     
    Jan Sundström, Oct 16, 2011
    #3
  4. Jan Sundström

    Brian Curtin Guest

    On Sun, Oct 16, 2011 at 11:16, Jan Sundström <> wrote:
    > On 16 Okt, 06:59, Christoph Gohlke <> wrote:
    >> On Oct 15, 1:13 pm, Jan Sundström <> 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.
     
    Brian Curtin, Oct 17, 2011
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ARaman
    Replies:
    1
    Views:
    398
    Mike Wahler
    Oct 23, 2003
  2. Ringwraith
    Replies:
    4
    Views:
    957
    Ringwraith
    Jan 27, 2004
  3. Scott Chapman

    Can't get curses to work in python

    Scott Chapman, Oct 8, 2004, in forum: Python
    Replies:
    0
    Views:
    377
    Scott Chapman
    Oct 8, 2004
  4. Jean-Paul Calderone
    Replies:
    2
    Views:
    444
    Joel Hedlund
    Feb 9, 2006
  5. Krist
    Replies:
    6
    Views:
    769
    Arne Vajhøj
    May 7, 2010
Loading...

Share This Page