Reviewed ActiveX/COM bug list

Christian Tismer tismer at appliedbiometrics.com
Mon May 10 09:13:21 EDT 1999


Last October, I posted a small collection of COM bugs.
After some discussion with greg Stein, it melted down
to two bugs.

[Mark, you might have missed that since you were very busy]

Now, meanwhile we are arrived at Win32all-125.exe, and
I was hit again by these two.
For one of them, the solution is know, and I'd like
to propose to change a single line in makepy.py.

> ------------------------------------------------------------------------
> 1) Word 8.0 problem with conversion functions:
> 
> Status: Not clarified yet. It is sure that the functions break
> and that is is a bug.

Example:
>>> import win32com.client
>>> w=win32com.client.Dispatch("word.application.8")
>>> w.Visible=1
>>> w.PointsToPicas(3)     # <-- this one always crashes, dunno why!
Traceback (innermost last):
  File "<interactive input>", line 0, in ?
  File "<COMObject word.application.8>", line 2, in PointsToPicas
  File "D:\Python\win32com\client\dynamic.py", line 207, in _ApplyTypes_
    result = apply(self._oleobj_.InvokeTypes, (dispid, LCID, wFlags,
retType, argTypes) + args)
com_error: (-2147467259, 'Unbekannter Fehler', None, None)>>> 

---

The following seems to be clarified and is just waiting to
go into the distribution. It also applies to MS-Access.

> ------------------------------------------------------------------------
> 2) Word problem 2: The DefaultNamedOptArg preset is wrong.

The default for DefaultNamedOptArg should be 
pythoncom.Empty and *not* pythoncom.Missing

Empty gives the correct behavior for all MS-Office tools I know.

Example: To open an Access database which is write protected, one
needs to specify the parameter ReadOnly=-1, but this doesn't work,
Access ignores it.
After changing the DefaultNamedOptArg to Empty, the named
parameter is obeyed.

 
VT_EMPTY 
 No value was specified. If an optional argument to an Automation method
is left blank, do not pass a VARIANT of type VT_EMPTY. Instead, pass a
VARIANT of type VT_ERROR with a value of DISP_E_MEMBERNOTFOUND. 
""" 

The COM docs say that for an missing optional parameter, one
should pass a VARIANT of VT_ERROR. This is exactly what
pythoncom.Empty contains.
I checked that for Word and Access with a little VBA test subroutine, 
and of course the missing parameters were reported as vartype 10 
which is vt_error.

cheers - chris

-- 
Christian Tismer             :^)   <mailto:tismer at appliedbiometrics.com>
Applied Biometrics GmbH      :     Have a break! Take a ride on Python's
Kaiserin-Augusta-Allee 101   :    *Starship* http://starship.python.net
10553 Berlin                 :     PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint       E182 71C7 1A9D 66E9 9D15  D3CC D4D7 93E2 1FAE F6DF
     we're tired of banana software - shipped green, ripens at home




More information about the Python-list mailing list