From: Mark H. <mha...@us...> - 2007-05-07 02:27:51
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/axscript/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17342/client Modified Files: error.py framework.py Log Message: Correct a number of issues with unicode, particularly errors. Index: error.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axscript/client/error.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** error.py 6 May 2007 12:03:51 -0000 1.8 --- error.py 7 May 2007 02:27:44 -0000 1.9 *************** *** 89,93 **** traceback.print_exc() # re-raise. ! raise sys.exc_info() def _BuildFromSyntaxError(self, site, value, tb): --- 89,93 ---- traceback.print_exc() # re-raise. ! raise def _BuildFromSyntaxError(self, site, value, tb): *************** *** 114,124 **** self.linetext = ExpandTabs(line.rstrip()) ! def _BuildFromOther(self, site, type, value, tb): self.colno = -1 self.lineno = 0 if debugging: # Full traceback if debugging. ! list=traceback.format_exception(type, value, tb) self.description = ExpandTabs(''.join(list)) - print "Script Traceback is", self.description return # Run down the traceback list, looking for the first "<Script..>" --- 114,123 ---- self.linetext = ExpandTabs(line.rstrip()) ! def _BuildFromOther(self, site, exc_type, value, tb): self.colno = -1 self.lineno = 0 if debugging: # Full traceback if debugging. ! list=traceback.format_exception(exc_type, value, tb) self.description = ExpandTabs(''.join(list)) return # Run down the traceback list, looking for the first "<Script..>" *************** *** 157,161 **** list = ['Traceback (most recent call last):\n'] list = list + traceback.format_list(format_items) ! if type==pythoncom.com_error: desc = "%s (0x%x)" % (value[1], value[0]) if value[0]==winerror.DISP_E_EXCEPTION and value[2] and value[2][2]: --- 156,160 ---- list = ['Traceback (most recent call last):\n'] list = list + traceback.format_list(format_items) ! if exc_type==pythoncom.com_error: desc = "%s (0x%x)" % (value[1], value[0]) if value[0]==winerror.DISP_E_EXCEPTION and value[2] and value[2][2]: *************** *** 163,172 **** list.append("COM Error: "+desc) else: ! list = list + traceback.format_exception_only(type, value) ! # list=traceback.format_exception(type, value, tb_top, depth) ! self.description = ExpandTabs(''.join(list)) # Clear tracebacks etc. tb = tb_top = tb_look = None - # sys.exc_type = sys.exc_value = sys.exc_traceback = None def ExtractTracebackInfo(self, tb, site): --- 162,175 ---- list.append("COM Error: "+desc) else: ! list = list + traceback.format_exception_only(exc_type, value) ! # all items in the list are utf8 courtesy of Python magically ! # converting unicode to utf8 before compilation. ! for i in range(len(list)): ! if type(list[i]) is str: ! #assert type(list[i]) is str, type(list[i]) ! list[i] = list[i].decode('utf8') ! self.description = ExpandTabs(u''.join(list)) # Clear tracebacks etc. tb = tb_top = tb_look = None def ExtractTracebackInfo(self, tb, site): *************** *** 184,187 **** --- 187,191 ---- codeBlock = None if codeBlock: + # Note: 'line' will now be unicode. line = codeBlock.GetLineNo(lineno) if line: Index: framework.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axscript/client/framework.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** framework.py 6 May 2007 12:03:51 -0000 1.24 --- framework.py 7 May 2007 02:27:44 -0000 1.25 *************** *** 62,66 **** self.redir.write(message) except: ! win32api.OutputDebugString(message) def flush(self): pass --- 62,66 ---- self.redir.write(message) except: ! win32api.OutputDebugString(message.encode('mbcs')) def flush(self): pass |