xzos / PyZDDE

Zemax/ OpticStudio Extension using Python
MIT License
159 stars 67 forks source link

GetPSF with OpticStudio 20.3.1 #105

Open mtalapinto opened 3 years ago

mtalapinto commented 3 years ago

Hi,

I've been trying to use ln.zGetPSF() and it throws me the following error - from the experience of another issue I read about this I included a line to set the text encoding.

TXT encoding is ASCII; no change required Traceback (most recent call last): File "C:/Users/marce/Documents/Ckepi/pyzmx/main.py", line 30, in getPSF() File "C:/Users/marce/Documents/Ckepi/pyzmx/main.py", line 24, in getPSF print(ln.zGetPSF()) File "C:\Users\marce\anaconda3\lib\site-packages\pyzdde\zdde.py", line 7820, in zGetPSF data_spacing_line = line_list[_getFirstLineOfInterest(line_list, 'Data spacing')] TypeError: list indices must be integers or slices, not NoneType Exception ignored in: <function PyZDDE.del at 0x0000027FF167D8B0> Traceback (most recent call last): File "C:\Users\marce\anaconda3\lib\site-packages\pyzdde\zdde.py", line 808, in del TypeError: 'NoneType' object is not callable

Now, if I switch the text encoding to unicode this is what I get

Successfully changed to UNICODE Traceback (most recent call last): File "C:/Users/marce/Documents/Ckepi/pyzmx/main.py", line 30, in getPSF() File "C:/Users/marce/Documents/Ckepi/pyzmx/main.py", line 24, in getPSF print(ln.zGetPSF()) File "C:\Users\marce\anaconda3\lib\site-packages\pyzdde\zdde.py", line 7821, in zGetPSF data_spacing = float(_re.search(r'\d{1,3}.\d{2,6}', data_spacing_line).group()) AttributeError: 'NoneType' object has no attribute 'group' Exception ignored in: <function PyZDDE.del at 0x0000023E4870D8B0> Traceback (most recent call last): File "C:\Users\marce\anaconda3\lib\site-packages\pyzdde\zdde.py", line 808, in del TypeError: 'NoneType' object is not callable

I am not sure whether is a pyzdde issue, or just how the new versions of OpticStudio encode the text. Thanks,

with kind regards,

Marcelo