Hi all,

I am a relatively new user of pywin32 package, but not Python. I have an application (written in C/#, as I understand) that provides a COM interface for using with other languages such as Python. I am using the pywin32 library to communicate with the application and it works fairly well. However, I am facing a particular kind of problem. The problem is that the application exposes some interface objects that inherit from other base objects but the methods defined in the base class objects doesn't seem to be accessible to the child class object. Is this type of behavior is atypical with pywin32? If so, what is the recommended way of addressing this problem? Currently, I am patching these methods in the child class object and delegating the calls to the parent object (using CastTo)) as shown in the pseudo-code below:

class MyBaseClass:
    ...
    ...
    def my_parent_method(self):
        base = win32com.client.CastTo(self, 'MyParentClass')
        return base.my_parent_method()
    ...


Although this strategy works, I would like to find out if there is a more efficient/ automatic way of resolving this issue. In my particular case, there are a large number of such objects (that inherit from some base class without access to the methods defined in the parent class) provided by the application and I would like to avoid re-writing all the methods for all such objects.

I hope I have been able to explain my problem well.

Thank you very much,
Best regards,
Indranil.
_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32

Reply via email to