On 2/27/19, Alan Gauld via Tutor <tutor@python.org> wrote: > On 27/02/2019 18:28, Chip Wachob wrote: >> Windows 7 vintage machine this morning. > > Caveat: I have no direct experience on Windows 7 - I jumped > from XP to Windows 8... Also I haven't used ANSIO codes in > Windows since the heady days of Windows 98! But... > >> run in the command window in Windows, from the terminal in Linux... > > Be aware that ANSI codes in DOS don't correspond directly > with the VT100 control codes commonly used in Linux etc. > You might get some things that either don;t work or work > slightly differently. > >> In the code I had included the ANSI escape characters so I could invert >> the >> text and change the color. > > Again remember that old ANSI terminals didn't have colors. > (They were either green on black, white on black, or if you > were really fancy, amber on black). > > Color came later so some terminal emulators won't do anything > with those codes. > >> As I have now learned, Windows 7 does not support this functionality. >> What do the experts out there suggest as the path of least pain and >> suffering? > > No idea if this works on Windows 7 but what we used to have > to do was load the ANSI.SYS driver in the CONFIG.SYS file > located in the root directory of the boot drive.
Windows NT systems use the Windows console API, which talks to a console that's hosted in a system process. In Windows 7+, each console is hosted in an instance of conhost.exe. In older versions of NT, consoles are hosted by threads in the session server process, csrss.exe. In 32-bit builds of NT, there's integration between the console and the virtual DOS machine (ntvdm.exe). This allows running old 16-bit DOS programs/drivers such as COMMAND.COM and ANSI.SYS in an emulated DOS environment. 64-bit builds no longer support NTVDM. Anyway, it wouldn't apply to Windows console applications such as python.exe, which have nothing to do with DOS. The only practical option is to implement VT sequences using the console API, such as is done by the colorama package. Other options require installing an alternate console (e.g. ConEmu) or a program that hacks the console API in each process via DLL injection (e.g. ANSICON). _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor