In general, if you `from win32com.client.gencache import EnsureDispatch`, you should be able to use `EnsureDispatch` anywhere you previously used plain `Dispatch`, and that code should be automatically generated and used for you. You generally only need to specify a special location or run makepy manually if there's something odd about the object which makes the above not work.

Mark

On 2024-03-18 10:25 a.m., Alok Bhargava wrote:
Many thanks Harald!

If I specify the file location when running makepy, how do I ensure myapplication knows where to find them?  Again this may be a silly question, so please bear with me.

Thank you!

On Mon, Mar 18, 2024 at 9:36 AM <haraldarminma...@gmail.com> wrote:

    Hi Alok,

    there should be a __gencache__ directory somewhere, which contains
    the generated files.
    But it is WAY easier to just use the

      -o    -- Create output in a specified output file. If the path
    leading
               to the file does not exist, any missing directories will be
               created.
               NOTE: -o cannot be used with -d.  This will generate an
    error.

    parameter of makepy.py

    cheers

    Harald

    On Mon, Mar 18, 2024 at 2:13 PM Alok Bhargava
    <akbharg...@gmail.com> wrote:

        Hi and thank you for your insightful guidance on Jannis'
        question.  I am running into similar issues as I work with a
        3rd party COM app.

        This may be a silly question but could you point me to where
        the generated class files are located?

        Many thanks!


        On Mon, Mar 18, 2024 at 7:43 AM <haraldarminma...@gmail.com>
        wrote:

            Hi Jannis,

            a good way forward: create less-dynamic COM-bindings by
            using makepy.py
            (it is part of your win32com-client installation, but
            linked here for the dokumentation)


            
https://github.com/SublimeText/Pywin32/blob/master/lib/x32/win32com/client/makepy.py

            With makepy py you can create a (very very large)
            python-file, which includes rather static bindings to
            reachable exposed attributes and methods.

            You can then grep or strg+f through that file for
            "HybridShapes" ... maybe it is just spelled differently.

            Using COM things for > 2 decades, apps run much smoother
            using the makepy created files than dynamic dispatch

            cheers

            Harald


            On Sun, Mar 17, 2024 at 7:35 PM Jannis via python-win32
            <python-win32@python.org> wrote:

                Hello together,


                I am trying to automate a point cloud creation out of
                CATParts in CATIA.
                The win32com client can access CATIA documents, but
                NOT methods and
                attributes in the parts. I get the following error:


                File
                
"C:\Users\th80im\source\repos\PythonPointCloudCreation\PythonPointCloudCreation\PythonPointCloudCreation\py37_env_1\lib\site-packages\win32com\client\dynamic.py",
                line 638, in __getattr__
                     raise AttributeError("%s.%s" % (self._username_,
                attr))
                AttributeError: <unknown>.HybridShapes


                I guess, there is something wrong with the registering
                of CATIA, or the
                installation of the client? Or am I looking in the
                wrong direction?


                Thank you & Best Regards

                ioannis

                _______________________________________________
                python-win32 mailing list
                python-win32@python.org
                https://mail.python.org/mailman/listinfo/python-win32



-- -- Harald Armin Massa
            Spielberger Straße 49
            70435 Stuttgart
            0173/9409607

            _______________________________________________
            python-win32 mailing list
            python-win32@python.org
            https://mail.python.org/mailman/listinfo/python-win32



-- -- Harald Armin Massa
    Spielberger Straße 49
    70435 Stuttgart
    0173/9409607


_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32
_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32

Reply via email to