I am currently trying to use python (Spyder) to connect with Zemax.
But I am getting the errors below (shown in the picture below) . I can’t find any solution.
I tried to use another python version - 3.7.0 , but still same error. Both standalone application and interactive extension result in same error messages.
Appreciate if anyone could give me some guidance. Thank you
Best answer by Sandrine AuriolView original
I’m assuming you are generating the tepmlate code from the latest OpticStudio version: Programming > Python > Standalone Application / Interactive Extension.
Can you tell us your version of Pythonnet as well? There have been issues with Pythonnet 3.0.0 and Zemax recommend using Pythonnet 2.5.2 for the moment:
Thank you for the advice. Yes, I am generating the template from that method.
I have uninstall Pythonnet 3.0.0 and installed 2.5.2. However, the error continue to occur.
Is there any other method/way I could try ?
I’m wondering if you are missing a required package for Python. In order for clr to work properly, you need to install the Pythonnet library. It could be corrupted as well, so try uninstalling/reinstalling it if you’ve already added it to your Python installation.
There are also some good suggestions here in this Community article: ZOSAPI_NetHelper cannot be added | Zemax Community.
I had a similar problem and this post helped me: https://stackoverflow.com/questions/47913079/python-attributeerror-module-object-has-no-attribute-addreference
@Ethan , @Sandrine Auriol
Thank you very much for the advice.
At the end , I uninstall everything (python and spyder) and install everything again. Then follow some of the guide above and it works.
I’m glad to hear you got it working! Thanks for updating the Community with your findings.