Description of problem: Params cannot be instantiated before api is imported. Version-Release number of selected component (if applicable): sdk: release 1.6.4-1 How reproducible: Steps to Reproduce: In [1]: import ovirtsdk.xml.params as p In [2]: p.Cluster() ERROR: An unexpected error occurred while tokenizing input The following traceback may be corrupted or invalid The error message is: ('EOF in multi-line statement', (2302, 0)) ERROR: An unexpected error occurred while tokenizing input The following traceback may be corrupted or invalid The error message is: ('EOF in multi-line statement', (7340, 0)) --------------------------------------------------------------------------- KeyError Traceback (most recent call last) /home/jhenner/work/rest-api-tests/<ipython-input-2-1ebbf7d062e4> in <module>() ----> 1 p.Cluster() /usr/lib/python2.7/site-packages/ovirtsdk/xml/params.pyc in __init__(self, href, id, name, description, actions, creation_status, link, cpu, data_center, memory_policy, scheduling_policy, version, supported_versions, error_handling) 5223 superclass = BaseResource 5224 def __init__(self, href=None, id=None, name=None, description=None, actions=None, creation_status=None, link=None, cpu=None, data_center=None, memory_policy=None, scheduling_policy=None, version=None, supported_versions=None, error_handling=None): -> 5225 super(Cluster, self).__init__(href, id, name, description, actions, creation_status, link, ) 5226 self.cpu = cpu 5227 self.data_center = data_center /usr/lib/python2.7/site-packages/ovirtsdk/xml/params.pyc in __init__(self, href, id, name, description, actions, creation_status, link, extensiontype_) 4144 superclass = None 4145 def __init__(self, href=None, id=None, name=None, description=None, actions=None, creation_status=None, link=None, extensiontype_=None): -> 4146 self.href = _cast(None, href) 4147 self.id = _cast(None, id) 4148 self.name = name /usr/lib/python2.7/site-packages/ovirtsdk/xml/params.pyc in __setattr__(self, item, value) 185 object.__setattr__(self, item, value.superclass) 186 elif not isinstance(value, list) and \ --> 187 ReflectionHelper.isModuleMember(sys.modules['ovirtsdk.infrastructure.brokers'], type(self)) and \ 188 self.__dict__.has_key('superclass') and self.superclass is not None and \ 189 not ReflectionHelper.isModuleMember(sys.modules['ovirtsdk.infrastructure.brokers'], type(value)) and\ KeyError: 'ovirtsdk.infrastructure.brokers' In [3]: from ovirtsdk import api In [4]: p.Cluster() Out[4]: <ovirtsdk.xml.params.Cluster at 0x241f190> Actual results: Expected results: p.Cluster() is instantiable no matter whether API is imported. Additional info:
by-design, also there is no reason to call this bug, importing several modules for certain module is a common not just in python, but also in others programming languages, and having import of ovirtsdk.api in params module not possible as it will create circular dependency, p.s note that /import/ paradigm is well documented.
(In reply to comment #1) > by-design, > > also there is no reason to call this bug, importing several modules > for certain module is a common not just in python, but also in others > programming languages, > > and having import of ovirtsdk.api in params module not possible > as it will create circular dependency What about pulling the common dependency to separate module? > > p.s note that /import/ paradigm is well documented. Where?
> What about pulling the common dependency to separate module? what 'common dependency'?, it's doesn't work because 'brokers' module has to be loaded in priori, and moving this dep. to any other module won't help as it will have to be loaded anyway according to dependencies chain, but i truly don't understand the problem, if documentation says that in order to use certain class, you have to import module a and module b, but you importing only b - you cannot expect the app. to work, also calling this bug doesn't make sense. >> p.s note that /import/ paradigm is well documented. > Where? wiki (this is only documentation for the upstream projects)