Fix UnicodeEncodingError, which prevents netrender, reprojection and playback from working on Windows in certain situations.

Users can set their machine name to something containing non-ascii characters. In Python this currently causes problem due to
socket.gethostname() throwing UnicodeEncodingError. Work around this by not using platform.system() (which uses internally socket.gethostname()).

See http://www.pasteall.org/16215 for backtrace
This commit is contained in:
Nathan Letwory
2010-10-13 21:53:37 +00:00
parent 32ac21ab02
commit a97af1449c
3 changed files with 18 additions and 5 deletions

View File

@@ -32,8 +32,13 @@ BLENDER_PATH = sys.argv[0]
CANCEL_POLL_SPEED = 2
MAX_TIMEOUT = 10
INCREMENT_TIMEOUT = 1
try:
system = platform.system()
except UnicodeEncodingError:
import sys
system = sys.platform
if platform.system() == 'Windows' and platform.version() >= '5': # Error mode is only available on Win2k or higher, that's version 5
if system in ('Windows', 'win32') and platform.version() >= '5': # Error mode is only available on Win2k or higher, that's version 5
import ctypes
def SetErrorMode():
val = ctypes.windll.kernel32.SetErrorMode(0x0002)