Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Curses module.

Reply
Thread Tools

Curses module.

 
 
Alex
Guest
Posts: n/a
 
      07-15-2003
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

 
Reply With Quote
 
 
 
 
Jp Calderone
Guest
Posts: n/a
 
      07-16-2003
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

 
Reply With Quote
 
 
 
 
Alex
Guest
Posts: n/a
 
      07-17-2003
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
 
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: Replacing curses (Was: Re: Problem with curses and UTF-8) Jean-Paul Calderone Python 2 02-09-2006 08:29 AM
Curses chgat Michael J. Barillier Perl 0 09-12-2004 05:10 AM
curses and color Skeleton Man Perl 0 05-25-2004 10:14 AM
Boxline in curses ( Linux ) M.Senthil Kumar C Programming 7 02-23-2004 11:39 AM
Re: Stopping a loop with user input. in curses Chatralias Python 0 07-20-2003 03:09 PM



Advertisments