Curses module.

Discussion in 'Python' started by Alex, Jul 16, 2003.

  1. Alex

    Alex Guest

    Hello all,

    I'm trying to learn Python, in particular the curses module. My system
    is running Slackware 9.0 and the verion of Python that comes installed
    with Slackware 9.0 is Python 2.2.2.

    I've been trying to access the curses.wrapper module without any
    success. I know that the wrapper exists in /usr/lib/python2.2/curses yet
    any reference that I make to it is rebuffed by the interpreter.

    Here's the python script I'm trying to run:

    Code:
    
    #!/usr/bin/python
    #
    # My first attempts at writing a curses interface using python
    
    import curses
    
    def newWindow():
    	begin_x = 20 ; begin_y = 7
    	height = 5 ; width = 40
    	win = curses.newwin(height, width, begin_y, begin_x)
    	return
    
    # Pass the function to the curses wrapper
    
    curses.wrapper(newWindow())
    
    
    This is the error message that I get when I try to run the script from
    the CLI:

    Traceback (most recent call last):
    File "./curses3.py", line 15, in ?
    curses.wrapper(newWindow())
    AttributeError: 'module' object has no attribute 'wrapper'

    Any ideas as to what I could be doing wrong?


    Alex the Python Newbie
    Alex, Jul 16, 2003
    #1
    1. Advertising

  2. Alex

    Jp Calderone Guest

    On Tue, Jul 15, 2003 at 07:03:33PM -0400, Alex wrote:
    > Hello all,
    >
    > I'm trying to learn Python, in particular the curses module. My system
    > is running Slackware 9.0 and the verion of Python that comes installed
    > with Slackware 9.0 is Python 2.2.2.
    >
    > I've been trying to access the curses.wrapper module without any
    > success. I know that the wrapper exists in /usr/lib/python2.2/curses yet
    > any reference that I make to it is rebuffed by the interpreter.
    >
    > Here's the python script I'm trying to run:
    >
    > [snip apparently correct code]
    >
    > This is the error message that I get when I try to run the script from
    > the CLI:
    >
    > Traceback (most recent call last):
    > File "./curses3.py", line 15, in ?
    > curses.wrapper(newWindow())
    > AttributeError: 'module' object has no attribute 'wrapper'
    >
    > Any ideas as to what I could be doing wrong?
    >


    Do you, perhaps, have a file named "curses.py" in your current directory?
    If so, "import curses" will load this, and not the stdlib module.

    You could also try printing "curses.__file__" to make sure the module is
    really coming from where you believe it is.

    Jp
    Jp Calderone, Jul 16, 2003
    #2
    1. Advertising

  3. Alex

    Alex Guest

    You were both correct.

    I simply had to get rid on the curses.py program (my first test program)
    and everything worked fine.

    Thanks again for the help. I can get down to some serious
    learning/hair-pulling frustration :)


    Alex
    Alex, Jul 17, 2003
    #3
    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. Abhijit Soman

    Curses module on windows

    Abhijit Soman, Jun 15, 2004, in forum: Python
    Replies:
    3
    Views:
    463
    Nick Jacobson
    Jun 15, 2004
  2. Jean-Paul Calderone
    Replies:
    2
    Views:
    436
    Joel Hedlund
    Feb 9, 2006
  3. Replies:
    3
    Views:
    608
    Thomas Dickey
    Jun 7, 2006
  4. kernel1983

    curses module bug in windows python?

    kernel1983, Jun 14, 2006, in forum: Python
    Replies:
    3
    Views:
    676
    Tim Daneliuk
    Jun 14, 2006
  5. Shea Martin

    no ptyhon curses module on solaris?

    Shea Martin, Nov 8, 2006, in forum: Python
    Replies:
    1
    Views:
    354
    Shea Martin
    Nov 8, 2006
Loading...

Share This Page