Can't blame you for keeping that competitive advantage, it does seem like a winning app to me! :)
the py docs do mention using a try/except bloc with wrapper() and also some good info in the python bug reports (http://bugs.python.org/ issue7567 as an example). hope it helps, and let me know if you need something tested on linux, will be glad to help. Thanks, Mart :) On Mar 19, 7:57 pm, Jonathan Lundell <jlund...@pobox.com> wrote: > On Mar 19, 2011, at 4:36 PM, Massimo Di Pierro wrote: > > > > > for me curses endwin does not restore console settings. I tried > > curses.wrapper and no luck. > > curses! > > There are a couple of stty hacks, if you're willing to call out to stty (with > the terminal as stdin). > > stty sane will do sort of what it implies: restore the terminal to a > reasonable setting. > > More elaborately, you can do this: > > save_state=$(stty -g) > mess it up > ... > stty "$save_state" > > (except pythonically) > > > > > > > > > > > On Mar 19, 6:28 pm, Jonathan Lundell <jlund...@pobox.com> wrote: > >> On Mar 19, 2011, at 3:37 PM, Massimo Di Pierro wrote: > > >>> Let me keep my competitive advantage for a while. ;-) > > >>> Besides I have this problem I cannot solve. Consider this code: > > >>> import terminal > >>> import time > >>> import sys > >>> import curses > >>> import os > > >>> screen = curses.initscr() > >>> curses.nocbreak() > >>> curses.echo() > >>> curses.endwin() > >>> curses.noraw() > >>> curses.nl() > >>> #curses.setupterm(term=os.environ.get("TERM", > >>> "unknown"),fd=sys.__stdout__.fileno()) > >>> for i in range(10): > >>> if i>0: sys.stdout.write(terminal.UP) > >>> sys.stdout.write(str(i)+'\n') > >>> time.sleep(0.1) > > >>> It is part of kryten. It messes up the shell (on Mac, I have not tried > >>> on Linux). How do I restore the shell from python programmatically? > > >> That's what endwin is supposed to do, assuming that you terminate normally. > > >> But curses.wrapper is a good idea, seems to me. > > >>> Massimo > > >>> On Mar 19, 5:19 pm, mart <msenecal...@gmail.com> wrote: > >>>> Massimo, you are enjoying this way too much! ;) > > >>>> Just kidding :) This is fantastic! I love this approach (input csv, > >>>> process, then output) - its clean, clear, concise and immensely > >>>> usable! > > >>>> Thanks :) > > >>>> P.s. Can we use your new and amazing application, kryten ? pretty > >>>> please? :) :) > > >>>> On Mar 19, 6:07 pm, Massimo Di Pierro <massimo.dipie...@gmail.com> > >>>> wrote: > > >>>>>http://vimeo.com/21239786