Show More
@@ -217,7 +217,7 b" commands.globalopts.append(('', 'color'," | |||
|
217 | 217 | _("when to colorize (always, auto, or never)"))) |
|
218 | 218 | |
|
219 | 219 | try: |
|
220 | import re | |
|
220 | import re, pywintypes | |
|
221 | 221 | from win32console import * |
|
222 | 222 | |
|
223 | 223 | # http://msdn.microsoft.com/en-us/library/ms682088%28VS.85%29.aspx |
@@ -243,7 +243,13 b' try:' | |||
|
243 | 243 | } |
|
244 | 244 | |
|
245 | 245 | stdout = GetStdHandle(STD_OUTPUT_HANDLE) |
|
246 | origattr = stdout.GetConsoleScreenBufferInfo()['Attributes'] | |
|
246 | try: | |
|
247 | origattr = stdout.GetConsoleScreenBufferInfo()['Attributes'] | |
|
248 | except pywintypes.error: | |
|
249 | # stdout may be defined but not support | |
|
250 | # GetConsoleScreenBufferInfo(), when called from subprocess or | |
|
251 | # redirected. | |
|
252 | raise ImportError() | |
|
247 | 253 | ansire = re.compile('\033\[([^m]*)m([^\033]*)(.*)', re.MULTILINE | re.DOTALL) |
|
248 | 254 | |
|
249 | 255 | def win32print(text, orig, **opts): |
General Comments 0
You need to be logged in to leave comments.
Login now