xzos / pyzos

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

OpticalSystem object creation fails in Python 3 with error "TypeError: type() argument 3 must be dict, not mappingproxy" #1

Closed indranilsinharoy closed 8 years ago

indranilsinharoy commented 8 years ago

Trying to create an OpticalSystem object as

osys = zos.OpticalSystem() 

fails with the following error:


TypeError                                 Traceback (most recent call last)
<ipython-input-11-e4a2b47ae305> in <module>()
----> 1 osys = zos.OpticalSystem( )
...
...
--> 214             Const = type('Const', (), _comclient.constants.__dicts__[0]) # Constants class
    215         return cls.app
    216 

TypeError: type() argument 3 must be dict, not mappingproxy

The root cause of this problem is that _comclient.constants.__dicts__[0] returns a dict in Python 2 and it returns a mappingproxy in Python 3.

indranilsinharoy commented 8 years ago

Fixed in https://github.com/pyzos/pyzos/pull/2