David Watson <bai...@users.sourceforge.net> added the comment: > platform.system() fails with UnicodeEncodeError on systems that have their > computer name set to a name containing non-ascii characters. The > implementation of platform.system() uses at some point socket.gethostname() ( > see http://www.pasteall.org/16215 for a stacktrace of such usage)
This trace is from a Windows system, where the platform module uses gethostname() in its cross-platform uname() function, which platform.system() and various other functions in the module rely on. On a Unix system, platform.uname() depends on os.uname() working, meaning that these functions still fail when the hostname cannot be decoded, as it is part of os.uname()'s return value. Given that os.uname() is a primary source of information about the platform on Unix systems, this sort of collateral damage from an undecodable hostname is likely to occur in more places. > It would be more than great if this error could be fixed. If another 3.1 > release is planned, preferrably for that. If you'd like to try the surrogateescape patches, they ought to fix this. The relevant patches are ascii-surrogateescape-2.diff, try-surrogateescape-first-4.diff and uname-surrogateescape.diff. ---------- title: socket, PEP 383: Mishandling of non-ASCII bytes in host/domain names -> socket, PEP 383: Mishandling of non-ASCII bytes in host/domain names _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue9377> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com