ZOS-API not compatible with modern versions of Python and pythonnet

  • 17 March 2023
  • 4 replies



I have read this knowledgebase article on how to use pythonnet with ZOS-API. It suggests using Python 3.4 to 3.8. Yet, 3.4 to 3.6 have reached end of life, 3.7 will in 3 months and 3.8 next year. Also, pythonnet 2.5 is no longer maintained. The only active development is focused on version 3+.

I would like to use ZOS-API work with modern versions of Python, 3.10+. The only pythonnet version compatible with them is 3+. Under these versions, quite a few ZOS-API calls are broken. For example, 


raises an exception due to how pythonnet 3+ handles the conversion of int32 and Enum between .NET<->Python.

Is there any way to use ZOS-API with these modern and maintained versions? Note that I don’t believe that using Python 3.8 or 3.9 with pythonnet 2.5.2 is a good solution, because pythonnet 2.5.2 is not actively maintained. The pythonnet team has stated multiple times that features/bugs would only be added/fixed in 3+ (for example here).


Thank you,


4 replies

Yes, this needs to be fixed ASAP.

But I’m sure the Zemax SW engineers are working on this, right?

Userlevel 6
Badge +2

Hi @Hans Martinsson and @Miloth ! I have reported this to our product team as Michael H has written a post saying how to use PythonNET 3.x:


Hi @Sandrine Auriol ,

Thank you for the reply. I will have a look at Michael H’s implementation and implement it in the script. Yet, do you have an estimated timeframe for the release of updated API docs and examples reflecting the required changes?

Thanks again.



Userlevel 6
Badge +2

Hi @Miloth 

I have just reported it to the product team so will let you know as soon as we hear back from them.