xzos / PyZDDE

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

ERROR: Unable to establish a conversation with server (err=0x400a). #102

Closed Luochenghuang closed 4 years ago

Luochenghuang commented 4 years ago

Hi devs,

This package looks perfect for my project. However I'm unable to get it to work. When I run

>>> import pyzdde.zdde as pyz
>>> ln = pyz.createLink()

I get an error.


ERROR: Unable to establish a conversation with server (err=0x400a).
ZEMAX may not be running!
Could not initiate instance.

I do have a Zemax instance open running on 19.8 professional version. Here's pip freeze result: pywin32==227 PyZDDE==2.0.3

I'm running on Python 3.7.4

Also, I'm able to run the Zemax Python API.

Any help is appreciated!

LucVV commented 4 years ago

Hi @Luochenghuang,

Sorry for the delayed reply, I hoped you managed to fix your problem. I cannot replicate this issue. Did you see this issue, it might be a subscription issue. YOu could also try to use the ZOS-API for your project, there is a package here that handles the basics, but is not fully developped. I have worked with this API as well, and I'm happy to help you.

Regards,

Luc

LucVV commented 4 years ago

Do you have 19.8 or 19.8 SP1? @JohnDGriffith, is this the error you got as well?

Luochenghuang commented 4 years ago

Hi @LucVV,

Thank you for the help! I just updated Zemax to 20.1.3 and PyZDDE magically started working! Thank you for the advice!

Best, Huang

LucVV commented 4 years ago

Glad to hear! Just as a note, the newer features of Zemax might not be available through PyZDDE, as they dropped their support for the DDE. With that, also new bugs are not fixed. One known bug is not with zSetField, as I indicated here. It is fixed in the online version of PyZDDE, but not yet in the latest release. If you find any other bugs, please let me know!

Luochenghuang commented 4 years ago

That's great to know, thank you for the help @LucVV !