[pywin32-bugs] [ pywin32-Bugs-887858 ] printing unicode subclass instance => TypeError
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: SourceForge.net <no...@so...> - 2004-01-30 21:36:28
|
Bugs item #887858, was opened at 2004-01-30 16:36 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=887858&group_id=78018 Category: pythonwin Group: None Status: Open Resolution: None Priority: 5 Submitted By: Jason Orendorff (jorend) Assigned to: Nobody/Anonymous (nobody) Summary: printing unicode subclass instance => TypeError Initial Comment: Ramon M. Felciano reported this problem to me. The bug happens when you enter code like the following into PythonWin's interactive window: class x(unicode): pass print x(u'hello world') (Full traceback at the bottom of this message.) I have win32all build 163. In this version, line 440 of "{PYTHONHOME}\lib\site-packages\Pythonwin\pywin\framework\winout.py" reads: if type(item) != UnicodeType: Changing this to "if not isinstance(type, UnicodeType):" fixes the problem for me, and I think it works in Python 2.2 as well; before that I dunno. (The reason this comes up at all is that my path class, http://www.jorendorff.com/articles/python/path, is a subclass of unicode on Windows.) PythonWin 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit (Intel)] on win32. Portions Copyright 1994-2001 Mark Hammond (mha...@sk...) - see 'Help/About PythonWin' for further copyright information. >>> class x(unicode): ... pass ... >>> print x(u'hello world') Traceback (most recent call last): File "<interactive input>", line 1, in ? File "C:\PROGRA~1\PYTHON~1.3\lib\site-packages\Pythonwin\pywin\framework\winout.py", line 172, in write return self.template.write(msg) File "C:\PROGRA~1\PYTHON~1.3\lib\site-packages\Pythonwin\pywin\framework\winout.py", line 487, in write self.HandleOutput(message) File "C:\PROGRA~1\PYTHON~1.3\lib\site-packages\Pythonwin\pywin\framework\winout.py", line 468, in HandleOutput self.QueueFlush() File "C:\PROGRA~1\PYTHON~1.3\lib\site-packages\Pythonwin\pywin\framework\winout.py", line 441, in QueueFlush item = unicode(item, default_platform_encoding) TypeError: decoding Unicode is not supported ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=887858&group_id=78018 |