Hello!
I’m attempting to use the `zosapi` package with
Below shows where the kernel crashes, without giving me a stack trace to try and diagnose why the kernel is crashing. Has anyone encountered this problem before?
Hello!
I’m attempting to use the `zosapi` package with
Below shows where the kernel crashes, without giving me a stack trace to try and diagnose why the kernel is crashing. Has anyone encountered this problem before?
Hi Jaren,
I just ran the following code with Python 3.8.10 & pythonnet 3.0.1 and I got no errors:
import numpy as np, matplotlib.pyplot as plt, zosapi, clr, os
dll = r'c:\temp\RayTrace.dll'
print(clr.AddReference(dll))
import BatchRayTrace
print('finished')
The print
output is:
The two things that I can think of without more information is:
Quick followup:
If you’re using Jupyter, for some reason, you need to establish a connection to OpticStudio before importing the BatchRayTrace dll. So the following code works in a Jupyter notebook:
import numpy as np, matplotlib.pyplot as plt, zosapi, clr, os
zos = zosapi.App()
dll = r'c:\temp\RayTrace.dll'
print(clr.AddReference(dll))
import BatchRayTrace
print('finished')
Hi Michael,
Thanks for your help! The establishment of a connection to OpticStudio in jupyter worked like a charm, thank you for the fix.
-Jaren
Hey Michael,
Tut tut tut...you’ll be banished from the Kingdom of Python if your import has to be done at a specific location
Ha Mark, I blame Jupyter’s python kernel. In pure python it’s implemented correctly and you can use import wherever you want.
Also, it appears that it’s an issue with the RayTrace.dll, not the zosapi PyPi module; it’s more of a C# logic and not Python logic. So you need to take it up with whomever wrote & compiled the RayTrace.dll. I heard it was someone with the initials MH, but I just don’t know who that could be. That MH will probably also be banished from the Kingdom of C# .
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.