[python-win32] Problem with simple example

Pochon Jérémie pochon.jeremie at gmail.com
Tue Jul 29 15:43:38 CEST 2008


https://sourceforge.net/tracker/?func=detail&atid=551954&aid=1998611&group_id=78018

2008/7/29 Murr Von Kater <newmurr at gmail.com>

> Hi all!
>
> I'm beginer in python-win32 and i try a simple example which is described
> in "Python for Win32 Extensions Help":
>
> import win32com.client
> o = win32com.client.Dispatch(" Excel.Application")
> o.Visible = 1
> o.Workbooks.Add() # for office 97 – 95 a bit different!
> o.Cells(1,1).Value = "Hello"
>
> But this example falls with traceback:
>
>   File "D:\Python25\pyprojects\pyexample\pyexample.py", line 6, in <module>
>     o.Workbooks.Add() # for office 97 – 95 a bit different!
>   File "D:\Python25\Lib\site-packages\win32com\client\dynamic.py", line
> 467, in __getattr__
>     if self._olerepr_.mapFuncs.has_key(attr): return
> self._make_method_(attr)
>   File "D:\Python25\Lib\site-packages\win32com\client\dynamic.py", line
> 295, in _make_method_
>     methodCodeList =
> self._olerepr_.MakeFuncMethod(self._olerepr_.mapFuncs[name], methodName,0)
>   File "D:\Python25\Lib\site-packages\win32com\client\build.py", line 297,
> in MakeFuncMethod
>     return self.MakeDispatchFuncMethod(entry, name, bMakeClass)
>   File "D:\Python25\Lib\site-packages\win32com\client\build.py", line 318,
> in MakeDispatchFuncMethod
>     s = linePrefix + 'def ' + name + '(self' + BuildCallList(fdesc, names,
> defNamedOptArg, defNamedNotOptArg, defUnnamedArg, defOutArg) + '):'
>   File "D:\Python25\Lib\site-packages\win32com\client\build.py", line 604,
> in BuildCallList
>     argName = MakePublicAttributeName(argName)
>   File "D:\Python25\Lib\site-packages\win32com\client\build.py", line 542,
> in MakePublicAttributeName
>     return filter( lambda char: char in valid_identifier_chars, className)
>   File "D:\Python25\Lib\site-packages\win32com\client\build.py", line 542,
> in <lambda>
>     return filter( lambda char: char in valid_identifier_chars, className)
> UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position 52:
> ordinal not in range(128)
>
> Is it bug or may be i should set some settings to make it works? I use
> WinXP and MS Office 2003. Python-win32 has been intalled on my PC with
> pywin32-211.win32-py2.5.exe installer.
>
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32
>
>


-- 
Jérémie POCHON

Portable : 06 19 50 00 48
mail : jeremie.pochon at supaero.fr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20080729/d9b5345d/attachment-0001.htm>


More information about the python-win32 mailing list