[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32454] trunk/blender/release/scripts: Fix UnicodeEncodingError, which prevents netrender, reprojection and playback from working on Windows in certain situations.

Martin Poirier theeth at yahoo.com
Fri Oct 15 00:45:15 CEST 2010


Has anyone reported that to the Python dev team?

The exception happens with socket.gethostname() it's something they should know.

Martin

--- On Wed, 10/13/10, Nathan Letwory <nathan at letworyinteractive.com> wrote:

> From: Nathan Letwory <nathan at letworyinteractive.com>
> Subject: [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32454] trunk/blender/release/scripts: Fix UnicodeEncodingError, which prevents netrender, reprojection and playback from working on Windows in certain situations.
> To: bf-blender-cvs at blender.org
> Received: Wednesday, October 13, 2010, 5:53 PM
> Revision: 32454
>           http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32454
> Author:   jesterking
> Date:     2010-10-13 23:53:37 +0200
> (Wed, 13 Oct 2010)
> 
> Log Message:
> -----------
> 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
> 
> Modified Paths:
> --------------
>    
> trunk/blender/release/scripts/io/netrender/slave.py
>     trunk/blender/release/scripts/op/image.py
>    
> trunk/blender/release/scripts/op/screen_play_rendered_anim.py
> 
> Modified:
> trunk/blender/release/scripts/io/netrender/slave.py
> ===================================================================
> ---
> trunk/blender/release/scripts/io/netrender/slave.py   
> 2010-10-13 19:56:53 UTC (rev 32453)
> +++
> trunk/blender/release/scripts/io/netrender/slave.py   
> 2010-10-13 21:53:37 UTC (rev 32454)
> @@ -32,8 +32,13 @@
>  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)
> 
> Modified: trunk/blender/release/scripts/op/image.py
> ===================================================================
> ---
> trunk/blender/release/scripts/op/image.py   
> 2010-10-13 19:56:53 UTC (rev 32453)
> +++
> trunk/blender/release/scripts/op/image.py   
> 2010-10-13 21:53:37 UTC (rev 32454)
> @@ -32,13 +32,17 @@
>  
>      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"]
> 
> Modified:
> trunk/blender/release/scripts/op/screen_play_rendered_anim.py
> ===================================================================
> ---
> trunk/blender/release/scripts/op/screen_play_rendered_anim.py   
> 2010-10-13 19:56:53 UTC (rev 32453)
> +++
> trunk/blender/release/scripts/op/screen_play_rendered_anim.py   
> 2010-10-13 21:53:37 UTC (rev 32454)
> @@ -30,14 +30,18 @@
>  
>  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):
> 
> 
> _______________________________________________
> Bf-blender-cvs mailing list
> Bf-blender-cvs at blender.org
> http://lists.blender.org/mailman/listinfo/bf-blender-cvs
> 




More information about the Bf-committers mailing list