diff options
author | Nathan Letwory <nathan@letworyinteractive.com> | 2010-10-14 01:53:37 +0400 |
---|---|---|
committer | Nathan Letwory <nathan@letworyinteractive.com> | 2010-10-14 01:53:37 +0400 |
commit | a97af1449c60219f7a7647fd029e623427632c22 (patch) | |
tree | 24372df5164fee95bd9a68cce8968e7b739b0504 /release | |
parent | 32ac21ab023ad90d994bac6a76aba0fa2da88176 (diff) |
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
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/io/netrender/slave.py | 7 | ||||
-rw-r--r-- | release/scripts/op/image.py | 8 | ||||
-rw-r--r-- | release/scripts/op/screen_play_rendered_anim.py | 8 |
3 files changed, 18 insertions, 5 deletions
diff --git a/release/scripts/io/netrender/slave.py b/release/scripts/io/netrender/slave.py index 526bd0b254f..7b5ae5e1d3d 100644 --- a/release/scripts/io/netrender/slave.py +++ b/release/scripts/io/netrender/slave.py @@ -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) diff --git a/release/scripts/op/image.py b/release/scripts/op/image.py index b897e7955a0..c6fbe7daf5f 100644 --- a/release/scripts/op/image.py +++ b/release/scripts/op/image.py @@ -32,13 +32,17 @@ class EditExternally(bpy.types.Operator): def _editor_guess(self, context): import platform - system = platform.system() + try: + system = platform.system() + except UnicodeEncodingError: + import sys + system = sys.platform image_editor = context.user_preferences.filepaths.image_editor # use image editor in the preferences when available. if not image_editor: - if system == 'Windows': + if system in ('Windows', 'win32'): image_editor = ["start"] # not tested! elif system == 'Darwin': image_editor = ["open"] diff --git a/release/scripts/op/screen_play_rendered_anim.py b/release/scripts/op/screen_play_rendered_anim.py index 53421642129..7b0a81b859d 100644 --- a/release/scripts/op/screen_play_rendered_anim.py +++ b/release/scripts/op/screen_play_rendered_anim.py @@ -30,14 +30,18 @@ import os def guess_player_path(preset): import platform - system = platform.system() + try: + system = platform.system() + except UnicodeEncodingError: + import sys + system = sys.platform if preset == 'BLENDER24': player_path = "blender" if system == 'Darwin': test_path = "/Applications/blender 2.49.app/Contents/MacOS/blender" - elif system == 'Windows': + elif system in ('Windows', 'win32'): test_path = "/Program Files/Blender Foundation/Blender/blender.exe" if os.path.exists(test_path): |