output on a new line in python curses
<p>I am using curses module in python to display output in real time by reading a file.
The string messages are output to the console using addstr() function
but I am not able to achieve printing to a newline wherever I need.</p>

<p>sample code: </p>

<pre><code>import json
import curses
w=curses.initscr()

try:
    while True:
        with open('/tmp/install-report.json') as json_data:
            beta = json.load(json_data)
            w.erase()
            w.addstr("\nStatus Report for Install process\n=========\n\n")
            for a1, b1 in beta.iteritems():
                w.addstr("{0} : {1}\n".format(a1, b1))
            w.refresh()
finally:
    curses.endwin()
</code></pre>

<p>The above is not really outputting the strings to a new line (notice the \n in addstr()) with each iteration. On the contrary, the script fails off with error if I resize the terminal window. </p>

<pre><code>w.addstr("{0} ==&gt; {1}\n".format(a1, b1))
_curses.error: addstr() returned ERR
</code></pre>