


{"id":160642,"date":"2021-07-23T18:34:38","date_gmt":"2021-07-23T18:34:38","guid":{"rendered":"\/forum\/forums\/topic\/problem-connecting-to-lumerical-via-python\/"},"modified":"2021-07-27T20:09:40","modified_gmt":"2021-07-27T20:09:40","slug":"problem-connecting-to-lumerical-via-python","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/problem-connecting-to-lumerical-via-python\/","title":{"rendered":"Problem Connecting to Lumerical via Python"},"content":{"rendered":"<div class=\"Item-Body\">\n<div class=\"Message userContent\">\n<p>Hello,<\/p>\n<p>Since renewing our license recently, I have been having trouble running my lumerical scripts via python. I end up getting the following error:<\/p>\n<p><\/p>\n<\/p>\n<p>Traceback (most recent call last):<\/p>\n<p>&nbsp;File &quot;.PC_SlabWG_Lumpy.py&quot;, line 687, in &lt;module&gt;<\/p>\n<p>&nbsp;&nbsp;average_dipole_simulations(**cli_kwargs)<\/p>\n<p>&nbsp;File &quot;.PC_SlabWG_Lumpy.py&quot;, line 85, in average_dipole_simulations<\/p>\n<p>&nbsp;&nbsp;slab_waveguide_emission_fractions_sim(**kwargs)<\/p>\n<p>&nbsp;File &quot;.PC_SlabWG_Lumpy.py&quot;, line 126, in slab_waveguide_emission_fractions_sim<\/p>\n<p>&nbsp;&nbsp;sim = lumpy.FDTD(hide=False)<\/p>\n<p>&nbsp;File &quot;Z:Lumericalv212apipythonlumapi.py&quot;, line 1298, in __init__<\/p>\n<p>&nbsp;&nbsp;super(FDTD, self).__init__(&#039;fdtd&#039;, filename, key, hide, serverArgs, **kwargs)<\/p>\n<p>&nbsp;File &quot;Z:Lumericalv212apipythonlumapi.py&quot;, line 1076, in __init__<\/p>\n<p>&nbsp;&nbsp;self.handle = open(product, key, hide, serverArgs)<\/p>\n<p>&nbsp;File &quot;Z:Lumericalv212apipythonlumapi.py&quot;, line 238, in open<\/p>\n<p>&nbsp;&nbsp;raise LumApiError(error)<\/p>\n<p>lumapi.LumApiError: &#039;appOpen error:<br \/>\n Failed to start messaging, check licenses&#8230;&#039;<\/p>\n<p>Exception ignored in: &lt;function Lumerical.__del__ at 0x000000051A0438C8&gt;<\/p>\n<p>Traceback (most recent call last):<\/p>\n<p>&nbsp;File &quot;Z:Lumericalv212apipythonlumapi.py&quot;, line 1174, in __del__<\/p>\n<p>&nbsp;&nbsp;close(self.handle)<\/p>\n<p>AttributeError: &#039;FDTD&#039; object has no attribute &#039;handle&#039;<\/p>\n<p><\/p>\n<\/p>\n<p>The following is the line of code it references that it seems to trip on:<\/p>\n<p>if platform.system().lower() == &quot;windows&quot;:<\/p>\n<p>&nbsp;&nbsp;lumapi_location = &quot;Z:\\Lumerical\\v212\\api\\python\\lumapi.py&quot;<\/p>\n<p><\/p>\n<\/p>\n<p>This appears to be similar to the issue posted here so I tried to follow the advice given.<\/p>\n<div class=\"js-embed embedResponsive\" data-embedJson=\"{&quot;recordID&quot;:28380,&quot;recordType&quot;:&quot;discussion&quot;,&quot;body&quot;:&quot;&lt;p&gt;Hello,&lt;\/p&gt;&lt;p&gt;I am running into an issue where I can run FDTD simulations via the GUI, but I cannot run them via the Python API. If I try to run the following line:&lt;\/p&gt;&lt;p&gt;fdtd = lumapi.FDTD(hide=False)&lt;\/p&gt;&lt;p&gt;The execution will just hang indefinitely. If I kill the script, I get the following error output:&lt;\/p&gt;&lt;p&gt;Traceback (most recent call last):&lt;\/p&gt;&lt;p&gt;&amp;nbsp;File &amp;quot;\/home\/rhome\/rollij2\/lumerical\/gf_grating_coupler\/45spclo\/sin_gc_uniform_base_sim.py&amp;quot;, line 502, in &amp;lt;module&amp;gt;&lt;\/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;with lumapi.FDTD(hide=False) as fdtd:&lt;\/p&gt;&lt;p&gt;&amp;nbsp;File &amp;quot;\/opt\/lumerical\/v211\/api\/python\/lumapi.py&amp;quot;, line 1294, in __init__&lt;\/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;super(FDTD, self).__init__(&amp;#039;fdtd&amp;#039;, filename, key, hide, serverArgs, **kwargs)&lt;\/p&gt;&lt;p&gt;&amp;nbsp;File &amp;quot;\/opt\/lumerical\/v211\/api\/python\/lumapi.py&amp;quot;, line 1072, in __init__&lt;\/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;self.handle = open(product, key, hide, serverArgs)&lt;\/p&gt;&lt;p&gt;&amp;nbsp;File &amp;quot;\/opt\/lumerical\/v211\/api\/python\/lumapi.py&amp;quot;, line 231, in open&lt;\/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;h = iapi.appOpen(url, k)&lt;\/p&gt;&lt;p&gt;KeyboardInterrupt&lt;\/p&gt;&lt;p&gt;Exception ignored in: &amp;lt;function Lumerical.__del__ at 0x7f84e04f6790&amp;gt;&lt;\/p&gt;&lt;p&gt;Traceback (most recent call last):&lt;\/p&gt;&lt;p&gt;&amp;nbsp;File &amp;quot;\/opt\/lumerical\/v211\/api\/python\/lumapi.py&amp;quot;, line 1170, in __del__&lt;\/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;close(self.handle)&lt;\/p&gt;&lt;p&gt;AttributeError: &amp;#039;FDTD&amp;#039; object has no attribute &amp;#039;handle&amp;#039;&lt;\/p&gt;&lt;p&gt;So it looks like it is getting stuck when it is trying to open an FDTD instance. This issue just started appearing today, seemingly out of nowhere. Any help in debugging or fixing the issue is greatly appreciated. \n\n","protected":false},"template":"","class_list":["post-160642","topic","type-topic","status-closed","hentry"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_author_ip":[""],"_bbp_old_reply_author_name_id":["Anonymous"],"_bbp_old_is_reply_anonymous_id":["false"],"_btv_view_count":["2016"],"_bbp_likes_count":["0"],"_bbp_subscription":["232487"],"_bbp_topic_status":["unanswered"],"_bbp_status":["publish"],"_bbp_topic_id":["160642"],"_bbp_forum_id":["27833"],"_bbp_engagement":["4274","213874"],"_bbp_voice_count":["2"],"_bbp_reply_count":["7"],"_bbp_last_reply_id":["186560"],"_bbp_last_active_id":["186560"],"_bbp_last_active_time":["2021-07-27 20:09:40"]},"test":"hbausercaltech-edu"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/160642","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics"}],"about":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/160642\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=160642"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}