Issue starting Lumerical FDTD via Python API outside of Lumerical

TAGGED: , , ,

    • edward.vansieleghem
      I recently ran into a problem that was previously encountered by some other users, and for which I could not yet find a great answer:
      At some point, I was not able to start FDTD with the Python API outside of lumarical (i.e. running ‘python3 ’ from console). However, I was still able to start an FDTD instance from the Python API when running python from within an existing FDTD GUI (i.e. running python from within an existing FDTD instance by using the ‘Run script’).
      A prototype script that would run from within Lumerical, but not from ouside of Lumerical:
      import lumapi

      fdtd = lumapi.FDTD(hide=False)

      print('I am in!')

      fdtd.close The problem appeared out of nowhere (no license, version, or configuration changes in either Lumerical or Python & LumApi propertly configured in PYTHONPATH). I believe it may have been triggered when—at some point—I failed to properly close a lumapi.FDTD instance before terminating the python interpreter (i.e. I did not call fdtd.close() before the interpreter closed/crached).
      After some digging in the ‘~/.ansys/ansyscl.xxxx.log’ file, I found out that the Ansys Licensing Interconnect was not started anymore when calling lumapi.FDTD() from the Python API outside of an existing FDTD instance. Therefore, the lumapi.FDTD() command would run indefinitely—presumably, while the python API was waiting for a response from the never-started license interconnect.
      After some more digging I found out that I was able to resolve/bypass the problem by setting the ‘ANSYSCL_SESSION_ID’ environmental variable manually in the terminal before starting FDTD from the Python API outside of Lumerical. That way, the Ansys Licensing Interconnect was able to start up properly again.
      This variable seems to be set automatically to something like ‘__dev_pts_4_’ when opening FDTD in the regular way (i.e. not from the Python API).
      Although I’m happy this hack fixes the problem, I’m sure this is not the intended behavior of the software.
      Could you please advise?
      Best regards Edward
    • Lito Yap
      Ansys Employee
      @vansieleghem, Try to set your environment variable as shown in the KB. >
Viewing 1 reply thread
  • You must be logged in to reply to this topic.