Skip to main content
Question

Unable to establish ZOS API connection to Python since Update to 2026R1.01

  • June 5, 2026
  • 3 replies
  • 41 views

Dear all,

 

I updated this morning to Zemax 2026 R1.01. Since then I get the following error message when trying to connect to Zemax with Python via API (e.g. by using the PythonStandAlone_01.py file):

“InitializationException: Unable to locate Zemax OpticStudio.  Try using a hard-coded path.”

 

Did anything change here?

 

Thank you and best regards,

 

Gregor

3 replies

  • Infrared
  • June 5, 2026

Hi, are you using in extension mode or standalone mode? or both!


  • Author
  • Infrared
  • June 5, 2026

I get the same message for both, extension and standalone. Looks like as if the path to something got lost. 


David.Nguyen
Luminary
Forum|alt.badge.img+2

@Gregor 

 

I haven’t installed 2026 R1.01, but I’ve read about similar topics in the past and reinstalling OpticStudio was often enough to solve the issue.

That being said, have you tried using a hard-coded path like the error suggests?

The message is a bit cryptic, but the code is looking for the API library files, usually in \Documents\Zemax\ZOS-API\Libraries (maybe also check that this folder exists for you and that it has files like ZOSAPI_NetHelper.dll) but the way it finds it is through lines like:

# determine location of ZOSAPI_NetHelper.dll & add as reference
aKey = winreg.OpenKey(winreg.ConnectRegistry(None, winreg.HKEY_CURRENT_USER), r"Software\Zemax", 0, winreg.KEY_READ)
zemaxData = winreg.QueryValueEx(aKey, 'ZemaxRoot')
NetHelper = os.path.join(os.sep, zemaxData[0], r'ZOS-API\Libraries\ZOSAPI_NetHelper.dll')

where it is looking for a key in the Windows Registry (ZemaxRoot), if that key gets messed up for whatever reason, it can explain the error.

Instead of this line:

NetHelper = os.path.join(os.sep, zemaxData[0], r'ZOS-API\Libraries\ZOSAPI_NetHelper.dll')

You could try to supply a hard-coded path:

NetHelper = r'C:\Users\your_username\Documents\Zemax\ZOS-API\Libraries\ZOSAPI_NetHelper.dll'

Sorry I don’t have a definite answer, hopefully it helps. The ZOSPy folks might be able to help further ​@chaasjes ​@jwbeenakker.

Take care,

 

Omni