473,418 Members | 2,078 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,418 software developers and data experts.

Curses module.

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:

Expand|Select|Wrap|Line Numbers
  1.  
  2. #!/usr/bin/python
  3. #
  4. # My first attempts at writing a curses interface using python
  5.  
  6. import curses
  7.  
  8. def newWindow():
  9. begin_x = 20 ; begin_y = 7
  10. height = 5 ; width = 40
  11. win = curses.newwin(height, width, begin_y, begin_x)
  12. return
  13.  
  14. # Pass the function to the curses wrapper
  15.  
  16. curses.wrapper(newWindow())
  17.  
  18.  
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

Jul 18 '05 #1
2 2591
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

Jul 18 '05 #2
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
Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Abhijit Soman | last post by:
Where can i find curses module for windows? I have pdcurses library on windows. But python binary doesnot include curses module. Thanks, Abhijit
0
by: Matthew Alton | last post by:
The appended program freaks python 2.2 & 2.3 completely out. To reproduce the wierdness: i) copy the source to a file called consarn.py ii) $ python consarn.py; iii) the program is now doing a...
0
by: Matt Garman | last post by:
I'd like to write a class or module in python that allows me to do on-the-fly color changing in the curses module. I'm thinking about something along the lines of this: addstr(y, x, 'hello',...
0
by: Brano Zarnovican | last post by:
Hi ! I'd like to init curses and still have working Python interactive command line. I found that you can replace stdin/stdout/stderr like this: #!/usr/bin/python -i import curses import...
3
by: skip | last post by:
I'm having no success building the curses module on Solaris 8 (yes, I know it's ancient - advancing the state-of-the-art is not yet an option) for Python 2.4. Sun provides an apparently ancient...
3
by: kernel1983 | last post by:
when I type command below in windows python: import curses it gives the error msg! It can't find _curses.pyd Is this a bug?
0
by: Fabian Braennstroem | last post by:
Hi, I want to add some radio and check buttons to my curses script. As I understand it, there are no buttons in the 'basic' curses module. Now, I found the curses-extra module, but I not able...
2
by: Kenneth McDonald | last post by:
I know that the curses module has a long-standing bug wherein cursor visibility can't be set. I'm looking at using the module for certain uses, and this isn't a problems (as long as I hide the...
5
by: 7stud | last post by:
I can't see to get any y, x coordinates to work with curses. Here is an example: import curses def my_program(screen): while True: ch = screen.getch() if ch == ord("q"): break
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.