-
-
July 23, 2021 at 6:34 pmhbauserSubscriber
Hello,
Since renewing our license recently, I have been having trouble running my lumerical scripts via python. I end up getting the following error:
Traceback (most recent call last):
 File ".PC_SlabWG_Lumpy.py", line 687, in
  average_dipole_simulations(**cli_kwargs)
 File ".PC_SlabWG_Lumpy.py", line 85, in average_dipole_simulations
  slab_waveguide_emission_fractions_sim(**kwargs)
 File ".PC_SlabWG_Lumpy.py", line 126, in slab_waveguide_emission_fractions_sim
  sim = lumpy.FDTD(hide=False)
 File "Z:Lumericalv212apipythonlumapi.py", line 1298, in __init__
  super(FDTD, self).__init__('fdtd', filename, key, hide, serverArgs, **kwargs)
 File "Z:Lumericalv212apipythonlumapi.py", line 1076, in __init__
  self.handle = open(product, key, hide, serverArgs)
 File "Z:Lumericalv212apipythonlumapi.py", line 238, in open
  raise LumApiError(error)
lumapi.LumApiError: 'appOpen error: Failed to start messaging, check licenses...'
Exception ignored in:
Traceback (most recent call last):
 File "Z:Lumericalv212apipythonlumapi.py", line 1174, in __del__
  close(self.handle)
AttributeError: 'FDTD' object has no attribute 'handle'
The following is the line of code it references that it seems to trip on:
if platform.system().lower() == "windows":
  lumapi_location = "Z:\Lumerical\v212\api\python\lumapi.py"
This appears to be similar to the issue posted here so I tried to follow the advice given.
Hello,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:
fdtd = lumapi.FDTD(hide=False)
The execution will just hang indefinitely. If I kill the script, I get the following error output:
Traceback (most recent call last):
File "/home/rhome/rollij2/lumerical/gf_grating_coupler/45spclo/sin_gc_uniform_base_sim.py", line 502, in <module>
with lumapi.FDTD(hide=False) as fdtd:
File "/opt/lumerical/v211/api/python/lumapi.py", line 1294, in __init__
super(FDTD, self).__init__('fdtd', filename, key, hide, serverArgs, **kwargs)
File "/opt/lumerical/v211/api/python/lumapi.py", line 1072, in __init__
self.handle = open(product, key, hide, serverArgs)
File "/opt/lumerical/v211/api/python/lumapi.py", line 231, in open
h = iapi.appOpen(url, k)
KeyboardInterrupt
Exception ignored in: <function Lumerical.__del__ at 0x7f84e04f6790>
Traceback (most recent call last):
File "/opt/lumerical/v211/api/python/lumapi.py", line 1170, in __del__
close(self.handle)
AttributeError: 'FDTD' object has no attribute 'handle'
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.
July 26, 2021 at 5:00 pmLitoAnsys EmployeePlease send a screenshot of your license configuration.
When you use the Lumerical bundled python and run the script from the CAD/GUI, do you have the same issue?
Run the python script below from the CAD to see if the issue happens.
import lumapi
lumapi.open
fdtd = lumapi.FDTD fdtd.addfdtd fdtd.addring fdtd.addmesh fdtd.save("mytestpy.fsp")
Send us the screenshot of the error when running the above script from the CAD.
Best,
Lito
July 26, 2021 at 6:11 pmhbauserSubscriberI have attached the license configuration. I'm able to open the GUI so that seems to be fine.
When I tried to run the python script from the GUI script window, I ended up with the same issue, that the module could not import h5py. I believe in the post linked in my original post you said that you can't import any new modules into the bundled python so to me this error seems to be stem from that limitation.
When running the script you provided I got a syntax error in the first line of "import lumapi". I have also attached the related screenshot.
July 26, 2021 at 6:21 pmLitoAnsys EmployeeYes, you will not be able to add modules into our bundled python. You will have to install Python3 in your machine and add the modules required by our API and your script. Then run your python script using your Python3 installation and set the PATH to include your Python installation, the Lumerical install and Lumerical API path in your environment variables.
Save the script as a python script with the extension ".py" and not as a Lumerical script file with the extention ".lsf".
July 26, 2021 at 6:35 pmJuly 26, 2021 at 6:38 pmLitoAnsys EmployeeThat is good. It indicates that the API is working. The issue is when you are trying to use a module that is not installed on your machine. Try the suggestion from my previous comment Yes, you will not be able to add modules into our bundled python. You will have to install Python3 in your machine and add the modules required by our API and your script. Then run your python script using your Python3 installation and set the PATH to include your Python installation, Lumerical, and API path in yourenvironment variables.
July 27, 2021 at 6:01 pmhbauserSubscriberThank you for your help. I was able to fix this problem by manually unchecking the "use Python provided by Lumerical" box in the GUI.
July 27, 2021 at 8:09 pmLitoAnsys EmployeeGlad to hear that the issue has been resolved.
Viewing 7 reply threads- The topic ‘Problem Connecting to Lumerical via Python’ is closed to new replies.
Ansys Innovation SpaceTrending discussions- Difference between answers in version 2024 and 2017 lumerical mode solution
- Errors Running Ring Modulator Example on Cluster
- INTERCONNECT – No results unless rerun simulation until it gives any
- Import material .txt file with script
- Trapezoidal ring
- Help for qINTERCONNECT
- Issues with getting result from interconnent analysis script
- Absorption cross-section of AuNR excited by prism-based TIR
- How to measure transmission coefficients on a given plane .
- Topology Optimization Error
Top Contributors-
1406
-
599
-
591
-
555
-
366
Top Rated Tags© 2025 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.
-