Here is a very small program that demonstrates the problem:
#!/usr/bin/env python3
import curses
import sys
import time
def main():
try:
stdscr = curses.initscr()
stdscr.clear()
stdscr.addstr(0,0, "This is the prompt")
stdscr.refresh()
time.sleep(3)
finally:
curses.endwin()
return 0
if __name__ == '__main__':
sys.exit(main())
If I change python3 to python, it works perfectly. With python3, I get a segmentation fault in the call to stdscr.refresh().
Answer: seems to be a bug in Apple's bundled Python. I went straight to python.org and downloaded their latest version and the problem seems to have gone away. Thanks for your help everybody.
Leaving this as not officially solved for a while, in case someone comes up with a better answer.