CRLF when doing os.system("ls -l") while using curses !!!

lsk040365 lkennedy5 at gmail.com
Sat May 30 14:15:30 EDT 2009


On May 29, 6:35 pm, Piet van Oostrum <p... at cs.uu.nl> wrote:
> >>>>> lkenne... at gmail.com (l) wrote:
> >l> Here is the code and as you can see for yourself, the output is not
> >l> coming out on the screen with CRLF like it should.  How do I fix this?
>
> Don't use curses.
>
> Curses puts the terminal in raw mode (more or less) which doesn't
> translate the newline character into CRLF. If you use curses you are
> supposed to do all output through curses. But the os.system goes
> directly to the screen, outside of curses (because it is another
> process).
> You could catch the output of ls -l with a PIPE and then write the
> output to the curses screen with addstr. But a curses screen has a
> limited length, whereas your ls -l output may be larger so then you must
> implement some form of scrolling.
>
> >l> import curses, os
> >l> screen = curses.initscr()
> >l> os.system("ls -l")
> >l> curses.endwin()
>
> --
> Piet van Oostrum <p... at cs.uu.nl>
> URL:http://pietvanoostrum.com[PGP 8DAE142BE17999C4]
> Private email: p... at vanoostrum.org

Can you provide me with some sort of example possibly--I have been
fighting this for a while and I wouldn't be using curses but I have
designed the program with the extended ascii characters thereby making
a nice UI...?

Thanks in advance,
Lee



More information about the Python-list mailing list