[Python-Dev] Windows IO (original) (raw)

David LeBlanc whisper@oz.net
Sun, 16 Mar 2003 23:57:24 -0800


It looks as though IO in Python (2.2.1), regardless of platform or device, happens in Objects/fileobject.c and, in particular, writing occurs in file_write(...)?

A few questions I hope a lurking (timbot? ;) ) person can answer:

  1. Is the above true, or does something different happen when using a Windows console/commandline?

  2. Is there any way to know if a console is being used (that a device is the console)?

  3. What's the purpose of the PC/msvcrtmodule.c file? Does it play any role in the regular pythonic IO scheme of things?

I'm interested in discovering if the Win32 API for screen reading/writing can be used so that character color attributes and cursor commands can be manipulated. It would be nice if those could be used transparently to a python application so that an application sending (for instance) ANSI color codes would succede and one that didn't wouldn't care. I realize this is sort of like curses - is there a Windows version of curses that plays well with Python and isn't GPL?

TIA,

David LeBlanc Seattle, WA USA