xzos / pyzos

Standalone Programming Interface for Zemax OpticStudio COM API in Python
MIT License
22 stars 10 forks source link

AttributeError: 'function' object has no attribute 'im_func' #8

Open brettsegler opened 7 years ago

brettsegler commented 7 years ago

I can't start a session with pyzos 0.0.8 and Opticstudio 16.5 SP4. I am getting the following respose:

import pyzos.zos as zos
osys = zos.OpticalSystem(sync_ui=True) # enable interactivity with a running UI

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-f53a44b0a298> in <module>()
      1 import pyzos.zos as zos
----> 2 osys = zos.OpticalSystem(sync_ui=True) # enable interactivity with a running UI
      3 

C:\tools\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\site-packages\pyzos\zos.py in __init__(self, sync_ui, mode)
    292 
    293         ## patch methods from ZOS IOpticalSystem to the wrapped object
--> 294         _replicate_methods(self._iopticalsystem, self)
    295 
    296     # Provide a way to make property calls without the prefix p,

C:\tools\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\site-packages\pyzos\zosutils.py in replicate_methods(srcObj, dstObj)
     62     for key, value in get_callable_method_dict(srcObj).items():
     63         if key not in overridden_methods:
---> 64             setattr(dstObj, key, zos_wrapper_deco(value))
     65 
     66 def get_properties(zos_obj):

C:\tools\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\site-packages\pyzos\zosutils.py in zos_wrapper_deco(func)
     55         def wrapper(*args, **kwargs):
     56             return wrapped_zos_object(func(*args, **kwargs))
---> 57         varnames = func.im_func.func_code.co_varnames # alternative is to use inspect.getargspec
     58         params = [par for par in varnames if par not in ('self', 'ret')] # removes 'self' and 'ret'
     59         wrapper.__doc__ = func.im_func.func_name + '(' + ', '.join(params) + ')'

AttributeError: 'function' object has no attribute 'im_func'
indranilsinharoy commented 7 years ago

Hi @brettsegler, I'm not actively developing this project any more (mostly because of the lack of interest). However, I'll try to look into this issue during the weekend (I can't promise though). I'm really sorry.

JohnDGriffith commented 7 years ago

I'm having the same problem. I guess that I will go back to pyZDDE

indranilsinharoy commented 7 years ago

@JohnDGriffith, I am really sorry that I'm currently not being able to fix these problems. I have been very busy for the last several months. I am actually surprised that some people have/are trying PyZOS! I'm really sorry, if I wasted any of your time.

JohnDGriffith commented 7 years ago

Hi Indranil,

No need to apologize. I understand completely. BTW, I have made extensive use of pyZDDE to drive Zemax for various engineering problems. I started to look at pyzos because I am worried that Zemax will remove the DDE interface in some future release. (Nobody at my company has any real understanding of Windows DDE or COM - we are all optical engineers, not trained software people.)

If Zemax does remove the DDE interface, could we contract with you to work on the pyzos module?

John D Griffith


From: Indranil Sinharoy notifications@github.com Sent: Thursday, June 15, 2017 1:07 AM To: indranilsinharoy/pyzos Cc: JohnDGriffith; Mention Subject: Re: [indranilsinharoy/pyzos] AttributeError: 'function' object has no attribute 'im_func' (#8)

@JohnDGriffithhttps://github.com/johndgriffith, I am really sorry that I'm currently not being able to fix these problems. I have been very busy for the last several months. I am actually surprised that some people have/are trying PyZOS! I'm really sorry, if I wasted any of your time.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/indranilsinharoy/pyzos/issues/8#issuecomment-308629980, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AcE0M-OUdm2NrLnPe6V2GLRCmogtwDU_ks5sELwigaJpZM4NcT05.

indranilsinharoy commented 7 years ago

@JohnDGriffith "If Zemax does remove the DDE interface, could we contract with you to work on the pyzos module?" Absolutely!

JohnDGriffith commented 7 years ago

Hi Indranil,

OK Great

John D Griffith


From: Indranil Sinharoy notifications@github.com Sent: Thursday, June 15, 2017 11:45 PM To: indranilsinharoy/pyzos Cc: JohnDGriffith; Mention Subject: Re: [indranilsinharoy/pyzos] AttributeError: 'function' object has no attribute 'im_func' (#8)

@JohnDGriffithhttps://github.com/johndgriffith "If Zemax does remove the DDE interface, could we contract with you to work on the pyzos module?" Absolutely!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/indranilsinharoy/pyzos/issues/8#issuecomment-308925498, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AcE0M3xj8eau7hdwMP-oEoRWBova-nRrks5sEfpngaJpZM4NcT05.

brettsegler commented 7 years ago

I am working with the ZOS-API like documented by ZEMAX for now. PyZos would be a great help. Finding the documentation for the functions is tedious. So I am very interested as well in any further development.

indranilsinharoy commented 7 years ago

@brettsegler Thank you. I am currently in a career transition period. I hope that will be able to further develop PyZOS in the near future.