<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"Lucida Console";
panose-1:2 11 6 9 4 5 4 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style></head><body lang=EN-GB link=blue vlink="#954F72"><div class=WordSection1><p class=MsoNormal>This issue has just been resolved. </p><p class=MsoNormal>Many Thanks</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='font-family:"Lucida Console"'>Regards<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Lucida Console"'>Toyin Awofala<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><div style='mso-element:para-border-div;border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal style='border:none;padding:0cm'><b>From: </b><a href="mailto:duncan@grisby.org">Duncan Grisby</a><br><b>Sent: </b>01 May 2020 10:51<br><b>To: </b><a href="mailto:toyin.awofala@gmail.com">Toyin Awofala</a>; <a href="mailto:omniorb-list@omniorb-support.com">omniORB-list</a><br><b>Subject: </b>Re: [omniORB] using class from omniidl compiler generated xyz_idl.py file</p></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>On Thu, 2020-04-30 at 21:06 +0100, Toyin Awofala via omniORB-list</p><p class=MsoNormal>wrote:</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>> I am writing a python corba client to a server app corba interface I</p><p class=MsoNormal>> generated a stub file YDS_idl.py y using omniidl compiler to compile</p><p class=MsoNormal>> idl provided by the server. I am able to get the serer IOR string</p><p class=MsoNormal>> representation with: </p><p class=MsoNormal>> orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID) </p><p class=MsoNormal>> obj = orb.string_to_object(SERVER_IIOP_URL) </p><p class=MsoNormal>> </p><p class=MsoNormal>> I now import class from the stub to narrow into a server obj. </p><p class=MsoNormal>> srv_obj = YDSAdminIF._narrow(obj) </p><p class=MsoNormal>> </p><p class=MsoNormal>> I keep getting error: </p><p class=MsoNormal>> from YDS_idl.py import YDSAdminIF ImportError: </p><p class=MsoNormal>> cannot import name YDSAdminIF</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>You are importing the wrong thing. You haven't told us what is in your</p><p class=MsoNormal>YDS.idl file, but it is definitely wrong to import YDS_idl, and you</p><p class=MsoNormal>never import Python code by including the .py extension in the import</p><p class=MsoNormal>statement.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>If YDS.idl contains a top-level module declaration like this:</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> module YDSModule {</p><p class=MsoNormal> interface YDSAdminIF {...};</p><p class=MsoNormal> };</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>then in Python you need to import YDSModule:</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> from YDSModule import YDSAdminIF</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>If, on the other hand, the IDL file does not contain a top-level</p><p class=MsoNormal>module, like this:</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> interface YDSAdminIF {...};</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>then the Python CORBA mapping says it is in a pretend module called</p><p class=MsoNormal>"_GlobalIDL", so you need to import that:</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> from _GlobalIDL import YDSAdminIF</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Duncan.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>-- </p><p class=MsoNormal> -- Duncan Grisby --</p><p class=MsoNormal> -- duncan@grisby.org --</p><p class=MsoNormal> -- http://www.grisby.org --</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>