Re: __getattr__ Error
[email protected] Mon, 18 Mar 2024 15:42:55 +0100
| Newsgroups | gmane.comp.python.windows |
|---|---|
| Message-ID | <CALUgi0_t1u=WBc41U58cOYFUw8EXdjmb-f4tqeCsjHtEW7f1=A@mail.gmail.com> |
--===============1650770895421114731== Content-Type: multipart/alternative; boundary="00000000000022e8040613f060e5" --00000000000022e8040613f060e5 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable My usage is: I have to bundle all the pys in one exe file. And do not want that exe-file to write into it's directory. So I do: makepy -o OLE_Excel16.py and within my program: import OLE_Excel16 as Excel olx =3D Excel.Application() On Mon, Mar 18, 2024 at 3:25=E2=80=AFPM Alok Bhargava <[email protected]= > 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=E2=80=AFAM <[email protected]> wrot= e: > >> 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 leadin= g >> 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=E2=80=AFPM Alok Bhargava <akbhargava@gmail.= com> >> wrote: >> >>> Hi and thank you for your insightful guidance on Jannis' question. I a= m >>> 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=E2=80=AFAM <[email protected]> wr= ote: >>> >>>> Hi Jannis, >>>> >>>> a good way forward: create less-dynamic COM-bindings by using makepy.p= y >>>> (it is part of your win32com-client installation, but linked here for >>>> the dokumentation) >>>> >>>> >>>> >>>> https://github.com/SublimeText/Pywin32/blob/master/lib/x32/win32com/cl= ient/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=E2=80=AFPM Jannis via python-win32 < >>>> [email protected]> 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\PythonPointClo= udCreation\PythonPointCloudCreation\py37_env_1\lib\site-packages\win32com\c= lient\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 t= he >>>>> installation of the client? Or am I looking in the wrong direction? >>>>> >>>>> >>>>> Thank you & Best Regards >>>>> >>>>> ioannis >>>>> >>>>> _______________________________________________ >>>>> python-win32 mailing list >>>>> [email protected] >>>>> https://mail.python.org/mailman/listinfo/python-win32 >>>>> >>>> >>>> >>>> -- >>>> -- >>>> Harald Armin Massa >>>> Spielberger Stra=C3=9Fe 49 >>>> 70435 Stuttgart >>>> 0173/9409607 >>>> >>>> _______________________________________________ >>>> python-win32 mailing list >>>> [email protected] >>>> https://mail.python.org/mailman/listinfo/python-win32 >>>> >>> >> >> -- >> -- >> Harald Armin Massa >> Spielberger Stra=C3=9Fe 49 >> 70435 Stuttgart >> 0173/9409607 >> >> --=20 -- Harald Armin Massa Spielberger Stra=C3=9Fe 49 70435 Stuttgart 0173/9409607 --00000000000022e8040613f060e5 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">My usage is: I have to bundle all the pys in one exe file.= And=C2=A0do not want that exe-file to write into it's directory.<div><= br></div><div>So I do:</div><div><br></div><div><br></div><div>makepy -o OL= E_Excel16.py</div><div><br></div><div>and within my program:</div><div><br>= </div><div>import OLE_Excel16 as Excel</div><div>olx =3D Excel.Application(= )<br></div><div><br></div><div><br></div></div><br><div class=3D"gmail_quot= e"><div dir=3D"ltr" class=3D"gmail_attr">On Mon, Mar 18, 2024 at 3:25=E2=80= =AFPM Alok Bhargava <<a href=3D"mailto:[email protected]">akbhargava@= gmail.com</a>> wrote:<br></div><blockquote class=3D"gmail_quote" style= =3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding= -left:1ex"><div dir=3D"ltr"><div>Many thanks Harald!</div><div><br></div><d= iv>If I specify the file location when running makepy, how do I ensure myap= plication knows where to find them?=C2=A0 Again this may be a silly questio= n, so please bear with me.</div><div><br></div><div>Thank you!<br></div></d= iv><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On = Mon, Mar 18, 2024 at 9:36=E2=80=AFAM <<a href=3D"mailto:haraldarminmassa= @gmail.com" target=3D"_blank">[email protected]</a>> wrote:<br>= </div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;b= order-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">Hi= Alok,<div><br></div><div>there should be a __gencache__ directory somewher= e, which contains the generated files.</div><div>But it is WAY easier to ju= st use the</div><div><br></div><div>=C2=A0 -o =C2=A0 =C2=A0-- Create output= in a specified output file.=C2=A0 If the path leading<br>=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0to the file does not exist, any missing directories= will be<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0created.<br>=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0NOTE: -o cannot be used with -d.=C2=A0 This = will generate an error.<br></div><div><br></div><div>parameter of makepy.py= </div><div><br></div><div>cheers</div><div><br></div><div>Harald</div></div= ><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Mo= n, Mar 18, 2024 at 2:13=E2=80=AFPM Alok Bhargava <<a href=3D"mailto:akbh= [email protected]" target=3D"_blank">[email protected]</a>> wrote:<br>= </div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;b= order-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"><d= iv>Hi and thank you for your insightful guidance on Jannis' question.= =C2=A0 I am running into similar issues as I work with a 3rd party COM app.= </div><div><br></div><div>This may be a silly question but could you point = me to where the generated class files are located?</div><div><br></div><div= >Many thanks!</div><div><br></div></div><br><div class=3D"gmail_quote"><div= dir=3D"ltr" class=3D"gmail_attr">On Mon, Mar 18, 2024 at 7:43=E2=80=AFAM &= lt;<a href=3D"mailto:[email protected]" target=3D"_blank">haraldar= [email protected]</a>> wrote:<br></div><blockquote class=3D"gmail_quote= " style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);= padding-left:1ex"><div dir=3D"ltr">Hi Jannis,<div><br></div><div>a good way= forward: create less-dynamic COM-bindings by using makepy.py=C2=A0</div><d= iv>(it is part of your win32com-client installation, but linked here for th= e dokumentation)</div><div><br></div><div><br></div><div><a href=3D"https:/= /github.com/SublimeText/Pywin32/blob/master/lib/x32/win32com/client/makepy.= py" target=3D"_blank">https://github.com/SublimeText/Pywin32/blob/master/li= b/x32/win32com/client/makepy.py</a><br></div><div><br></div><div>With makep= y py you can create a (very very large) python-file, which includes rather = static bindings=C2=A0to</div><div>reachable exposed attributes and methods.= </div><div><br></div><div>You can then grep or strg+f through that file for= "HybridShapes" ... maybe it is just spelled differently.</div><d= iv><br></div><div>Using COM things for > 2 decades, apps run much smooth= er using the makepy created files than dynamic dispatch</div><div><br></div= ><div>cheers</div><div><br></div><div>Harald</div><div><br></div></div><br>= <div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Sun, Ma= r 17, 2024 at 7:35=E2=80=AFPM Jannis via python-win32 <<a href=3D"mailto= :[email protected]" target=3D"_blank">[email protected]</a>>= wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px = 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello to= gether,<br> <br> <br> I am trying to automate a point cloud creation out of CATParts in CATIA.<br= > The win32com client can access CATIA documents, but NOT methods and<br> attributes in the parts. I get the following error:<br> <br> <br> File<br> "C:\Users\th80im\source\repos\PythonPointCloudCreation\PythonPointClou= dCreation\PythonPointCloudCreation\py37_env_1\lib\site-packages\win32com\cl= ient\dynamic.py",<br> line 638, in __getattr__<br> =C2=A0=C2=A0 =C2=A0 raise AttributeError("%s.%s" % (self._usernam= e_, attr))<br> AttributeError: <unknown>.HybridShapes<br> <br> <br> I guess, there is something wrong with the registering of CATIA, or the<br> installation of the client? Or am I looking in the wrong direction?<br> <br> <br> Thank you & Best Regards<br> <br> ioannis<br> <br> _______________________________________________<br> python-win32 mailing list<br> <a href=3D"mailto:[email protected]" target=3D"_blank">python-win32@p= ython.org</a><br> <a href=3D"https://mail.python.org/mailman/listinfo/python-win32" rel=3D"no= referrer" target=3D"_blank">https://mail.python.org/mailman/listinfo/python= -win32</a><br> </blockquote></div><br clear=3D"all"><div><br></div><span class=3D"gmail_si= gnature_prefix">-- </span><br><div dir=3D"ltr" class=3D"gmail_signature"><d= iv dir=3D"ltr">--<div>Harald Armin Massa<br>Spielberger Stra=C3=9Fe 49<br>7= 0435 Stuttgart<br>0173/9409607<br><br></div></div></div> _______________________________________________<br> python-win32 mailing list<br> <a href=3D"mailto:[email protected]" target=3D"_blank">python-win32@p= ython.org</a><br> <a href=3D"https://mail.python.org/mailman/listinfo/python-win32" rel=3D"no= referrer" target=3D"_blank">https://mail.python.org/mailman/listinfo/python= -win32</a><br> </blockquote></div> </blockquote></div><br clear=3D"all"><div><br></div><span class=3D"gmail_si= gnature_prefix">-- </span><br><div dir=3D"ltr" class=3D"gmail_signature"><d= iv dir=3D"ltr">--<div>Harald Armin Massa<br>Spielberger Stra=C3=9Fe 49<br>7= 0435 Stuttgart<br>0173/9409607<br><br></div></div></div> </blockquote></div> </blockquote></div><br clear=3D"all"><div><br></div><span class=3D"gmail_si= gnature_prefix">-- </span><br><div dir=3D"ltr" class=3D"gmail_signature"><d= iv dir=3D"ltr">--<div>Harald Armin Massa<br>Spielberger Stra=C3=9Fe 49<br>7= 0435 Stuttgart<br>0173/9409607<br><br></div></div></div> --00000000000022e8040613f060e5-- --===============1650770895421114731== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ python-win32 mailing list [email protected] https://mail.python.org/mailman/listinfo/python-win32 --===============1650770895421114731==--