Can't use curses!

So, after some hard searching, I’ve found out how to use curses for my program.

But I’ve run into an error.
This piece of code:

import curses
stdscr = curses.initscr()

results in this error:

Traceback (most recent call last):
  File "C:\Documents and Settings\Home\Bureaublad\curses.py", line 1, in ?
    import curses
  File "C:\Documents and Settings\Home\Bureaublad\curses.py", line 2, in ?
    stdscr = curses.initscr()
AttributeError: 'module' object has no attribute 'initscr'

And I don’t like that attitude.
I’m using Windows XP.
How can I solve this problem? :confused:

Thanks for replying!

Cheers :wink:

Are you trying to say “cursors”?

http://www.gnu.org/software/ncurses/ncurses.html

I have checked the code and I have not made any spelling errors.
I have been following an introduction to curses (which I hope to use in a text-based game I’m currently developing), but Python won’t even let me initialize it.
Has anyone else experienced this problem and can you tell me what to do to get it working?

Sorry, didn’t know what you were talking about, I just thought you might be talking about cursors, like mouse cursors. Haha, I’m stupid. Yeah, sorry about that.

Don’t sweat it :wink:
But curses is supposed to be able to handle mouse cursors. I read that somewhere, I think.
Maybe I’ll do that one day, if only I can get curses to work :rolleyes:

I haven’t done anything with Python-Curses, maybe this will help ? (unless you’ve already seen it)

http://www.amk.ca/python/howto/curses/

Mike

Thanks for the help, Mike, but I know how to use curses.
The problem is that they don’t work. They should, but they don’t.
And I want to find out why they don’t work like the should.

I hate to ask this, but have you installed the curses module in the right place? I haven’t used curses, but I’ve used other external modules without trouble.

RS

Where did you get the curses library from ?

What version of Python are you running?

The error message is saying that initscr() doesn’t exist: (or that it can’t find it)

Try:

import curses 
print dir(curses)

(or better ... easier to read)

for i in dir(curses):
  print i

That will show all the attributes for the curses module. It might be as simple as that it has been renamed to “InitScr” :slight_smile:

I just downloaded the Binary (Python 2.4.1) of wcurses from here http://adamv.com/dev/python/curses/

initscr works with this distrib (python 2.4 / WinXp / Blender 2.42a)

Mike

It’s probably because the file has the same name as the module. If you name the file curses.py, and the module is also curses.py, the file might be importing itself, instead of the module.

You’re right, Friday13!
I fixed it and it works smoothly now.
Ah well, that’s one more thing we know.

Thanks for everyone’s input :wink:

slaps Charlesworth999 with the Python Tutorial

I skipped that part :rolleyes: