Closed B2015 closed 7 years ago
Hi Ben,
Thanks very much for spreading the word.
I have seen these type of problems a few times before (that's the reason why I decided to put the "assert ret == 0" in order to localize the error. Although I don't have an exact solution, but I have noted a few things that could potentially result in this type of problem:
pyz.getTextEncoding()
, assuming you have done import pyzdde.zdde as pyz
at the beginning. To set the text encoding, use pyz.setTextEncoding()
.C:\tmp
), and provide a very short names (e.g. c:\tmp\tmp.txt
, and c:\tmp\<lens_filename.cfg>
) to ensure that the function works. Also, I would set keepFile=True
to see what file has been dumped.IOError: [Errno 2] No such file or directory: ...
I wish Zemax would have returned a more useful error code.
I hope that helps.
Best regards, Indranil.
Hello Indranil,
Thanks much for the help! We already checked your first point and made sure the text encoding is correct. I think that you second point may be spot on because the path he's using is quite long, I'll suggest him to put the Zemax files somewhere else and see if it works well.
By the way, I tested a script using zGetPSF on yet another colleague's computer (did I tell you about spreading the word ;-) ), and found a small issue while trying to read the 2D psf_data. Indeed, the zdde regex is looking for number where the exponent contains 3 digits while for some reasons, the text file returned by zemax/OS on my other colleague's computer has only two digits. To prevent this I would suggest transforming the current pattern:
pat = (r'(-?\d.\d{4,6}[Ee][-+]\d{3}\s*)' + r'{{{num}}}' .format(num=img_grid_x))
into:
pat = (r'(-?\d.\d{4,6}[Ee][-+]\d{2,3}\s*)' + r'{{{num}}}' .format(num=img_grid_x))
Cheers,
Ben
Hi Ben,
Thanks very much for the suggestion on the regex pattern. I will update the code based on your suggestion. Till then I will keep this issue open.
Best regards, Indranil.
Hello,
I recently gave a piece of code using PyZDDE (trying to preach the good news around) to a colleague and it looks like he's not able to make it work.
From the logs I see that the problem occurs in zGetPSF where the "assert ret == 0" is false (ret gets a value of -1 instead of 0). This value is returned by zGetTextFile. From the documentation I understand that such a value of -1 is associated with the fact that a text file could not be saved (Zemax may not have received a full path name or extention). The log seems quite self-explaining, the problem being that I can't test my colleague's issue further since he's currently not in the country.
So I was wondering whether you already experienced such an issue using zGetPSF, I'm sure it's most likely coming from something we forgot to do at setup but without the possibility to make printouts etc, its tough to solve.
Thanks much for your help,
Best regards,
Ben