grongierisc / interoperability-embedded-python

Hack of PEX Python but for Embedded Python
MIT License
13 stars 6 forks source link

Cannot register classes from a submodule import #24

Closed Antoine-dh closed 1 month ago

Antoine-dh commented 1 month ago

Consider the following project structure:

demo
├── bo.py
├── settings.py
└── sub
    └── bo.py

settings.py

import bo
import sub.bo

CLASSES = {
    'demo.bo.MyOperation': bo.MyOperation, # working
    'demo.sub.MySubOperation': sub.bo.MySubOperation, # not working
    'demo.sub.MySubOperation2': { # working alternative
        'module': 'bo',
        'class': 'MySubOperation',
        'path': '/irisdev/app/src/python/demo/sub'
    },
}

When trying to run iop migrate I encounter the following error:

irisowner@f2218db55070:/irisdev/app$ iop -m src/python/demo/settings.py 
Traceback (most recent call last):
  File "/home/irisowner/.local/lib/python3.10/site-packages/iop/_utils.py", line 55, in register_component
    iris.cls('IOP.Utils').dispatchRegisterComponent(module,classname,path,overwrite,iris_classname)
RuntimeError: ERROR <Ens>ErrGeneral: ObjectScript error: GetRemoteClassInfo+31^IOP.Utils.1^2^       
set class = builtins.getattr(module, pRemoteClassname) *<class 'AttributeError'>: module 'sub.bo' has no attribute 'MySubOperation' - 
Antoine-dh commented 1 month ago

Nevermind, I was not up to date, this got fixed 3 days ago in 3.1.3