On Tue, Jan 3, 2023 at 9:08 PM Mark Hammond <skippy.hamm...@gmail.com> wrote:
> ...
> This is probably just defined by IDispatch and related interfaces. There
> is a good chance that JScript magically uses multiple interfaces at the
> same time for an object, whereas Python only tends to use one.

Right. Presumably JScript either examines the COM introspection
information and figures out which interface can handle the request or
(sloppier) it tries each in a try ... catch block until one doesn't
fail. (Same for VBScript.)

> I suspect the root of the problem is that Python ends up in
> https://github.com/mhammond/pywin32/blob/main/com/win32com/client/__init__.py#L38,
> and as you can see it only uses the first possible type info for the
> IDispatch. It would be interesting to know if the objects with this
> behaviour have multiple entries there with the one you care about being
> at somewhere other than 0.

From what I can tell (at least for the paths I tested this morning),
that helper function is never called without resultCLSID being set, so
that block of the code is never entered (for our application).

> But even if that's true, I'm not quite sure what you can do to smooth
> this over - we can't just make that code use, say, `[-1]` - but it still
> would be useful to identify if that's the problem.

Well, at least we have a workaround that works. And our consolation
prize is that the workaround is probably more efficient than the
dynamic interface navigation the scripting engine would do.

Again, thanks for all your patient help. The fact that this project
has successfully reached the point of user acceptance testing owes a
lot to your generous and capable assistance.

🙏🏼
Gratefully,
Bob
_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32

Reply via email to