Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8527355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:32:04+00:00 2026-06-11T08:32:04+00:00

I am not so into ncurses, but it should be working on C, I

  • 0

I am not so into ncurses, but it should be working on C, I do not know what is wrong, I just want to print some character to screen continuosly but I cannot find how to fix this error:

    File "capture.py", line 37, in <module>
     stdscr.move(y,x)
    _curses.error: wmove() returned ERR  

Code:

(irrelevant parts of the code are removed)
import curses

stdscr = curses.initscr()
curses.noecho();

palette = [' ', ' ', '.', '.', '/', 'c', '(', '@', '#', '8']

# index is something between 0 and len(palette), not important 
for x in xrange(50):
    for y in xrange(30):
        stdscr.move(y,x)
        sdtscr.addch(palette[index])
stdscr.refresh()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T08:32:06+00:00Added an answer on June 11, 2026 at 8:32 am

    If you read the documentation for curses move (e.g., http://linux.die.net/man/3/move):

    These routines return ERR upon failure and OK (SVr4 specifies only “an integer value other than ERR”) upon successful completion.

    Specifically, they return an error if the window pointer is null, or if the position is outside the window.

    The first doesn’t seem likely to come up in Python, so the second is probably your problem. And a quick test shows that running your code works fine on a terminal that’s 30 rows or taller, but fails on a typical 24- or 25-row terminal.

    If you want to make it easier to debug, first wrap the whole thing in a try/finally: curses.endscr() (so your terminal isn’t left in a mess, possibly making it impossible to see the output). Then wrap the call to stdscr.move in a try/except: that logs x and y so you know where it fails. I’d also make the “30” into a command-line argument for quicker testing. Here’s a version with all those changes:

    #!/usr/bin/python
    
    import sys
    import curses
    
    height = int(sys.argv[1]) if len(sys.argv) > 1 else 24
    
    try:
        stdscr = curses.initscr()
        curses.noecho();
    
        palette = [' ', ' ', '.', '.', '/', 'c', '(', '@', '#', '8']
    
        index = 0
        for x in xrange(50):
            for y in xrange(height):
                index = (index + 1) % len(palette)
                try:
                    stdscr.move(y,x)
                except Exception as e:
                    stdscr.refresh()
                    curses.endwin()
                    print
                    print x, y, e
                    sys.exit(1)
                stdscr.addch(palette[index])
        stdscr.refresh()
    finally:
        curses.endwin()
    

    Now python cursetest 30 prints:

    0 25 wmove() returned ERR
    

    So, as I suspected, it’s failing at x=0, y=25.

    And if I stretch my terminal out to 80×50, it works, but now python cursetest 60 fails:

    0 50 wmove() returned ERR
    

    For that matter, if I shrink my terminal to 40×50, python cursetest 30 fails at the horizontal edge rather than the vertical:

    40 0 wmove() returned ERR
    

    If you want to check for this in advance rather than trying to catch the error when it happens, try calling getmaxyx() on the window; if y<30 you can display a nice error message and quit (or do something different, or whatever).

    Finally, a quick check shows that this doesn’t work in C either. Of course there’s no exception thrown, and you can ignore the error that’s returned if you want, but you just end up writing to position (24, 49) 300 times in a row. (And you could do the same thing in Python by doing a try/catch/pass around the move, if you really wanted…)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am not much into gaming but i am learning and doing some practicles
I've not gone into much research here, but the intuitive thing is not working:
Probably very simple question (I just want to ensure I'm right). Title is not
I know it is quite some weird goal here but for a quick and
i'm not really into basics algorithm programming, so here's my problem. I want to
I know that someone is going to want code for this issue but the
My application does not fit into the general purpose RDBMS schema category, I do
I'm not much into COM interfaces, so i have a small question, say I
What ring does qemu execute in when not tied into an existing hypervisor? Any
Long.parseLong(string) throws an error if string is not parsable into long. Is there a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.