Hi Hongfeng,
Thanks for your post here on the Community Forums!
I am sorry to hear that you have problems running the PPG application example.
The AttributeError: 'NoneType' object has no attribute ' ' type of error usually appears if there is one tool already open, and you are trying to open a second one without closing the previous one. In OpticStudio, and also in the ZOS-API, only one tool can be open at a time. You can workaround this issue by closing the current tool, as suggested in the thread below:
What is this error "Attribute error: object has no attribute…" in the ZOS-API? | Zemax Community
Further troubleshooting steps for Attribute Errors, detailed discussions about how to interact with OpticStudio from the API, and the differences between using Python via COM or .NET connection can be found here:
ZOS-API Python: How to deal with AttributeError and apply the correct enumeration | Zemax Community
Specifically for the PPG example, could you please double-check the path of the file being opened by Python? It should be local and a .ZMX file (not only the .ZAR included in the article).
Finally, could you please try and run one of the sample codes we have in OpticStudio (help>ZOS-API Syntax Help>Examples>Example 01 - Python) to check if it is working out of the box for you? This is to verify that the connection between OpticStudio and the Python API works as expected.
If the problem still persists, please contact Zemax Support directly at support@zemax.com, so that we can provide targeted help for your problem.
Best,
Csilla