[python-win32] Non-ascii character in source code cause 'Exception occurred'

aurora aurora00 at gmail.com
Mon Jul 3 19:42:08 CEST 2006


P.S. The script can actually process unicode, passing unicode text to and  
 from other COM objects. E.g.

   print u'\N{Euro Sign}'.encode('utf-8')

The only problem is the source code cannot have any non-ascii characters.

wy


> I find that putting any non-ascii character in the Python source code
> would cause an unspecific "Exception  occurred" error. For example,
>
> _u.py
>
>    # €
>    print 'hello'
>
>
> g:\usr\bin\EmEditor Macros>cscript /e:python  _u.py
> Microsoft (R) Windows Script Host Version 5.6
> Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
>
> CScript Error: Execution of the Windows Script Host failed. (Exception
> occurred. )
>
>
>
> Any presence of a non-ascii character, even if it is in the comment only,
> would cause this problem. I have tried various encoding, with or without
> BOM, and also adding the encoding specification at the top of the file.
> All these give the same result. On the other hand a similar Javascript
> would run alright.
>
> Is this a win32 implementation issue?
>
> wy




More information about the Python-win32 mailing list