tcalmant / ipopo

iPOPO: a Service-Oriented Component Model for Python
https://ipopo.readthedocs.io/
Apache License 2.0
69 stars 28 forks source link

"No iPOPO service available" when running example from the doc #94

Closed matthieucan closed 6 years ago

matthieucan commented 6 years ago

When running the code at https://ipopo.readthedocs.io/en/latest/refcards/init_config.html#sample-api-usage I get the following stacktrace:

Traceback (most recent call last):
  File "run.py", line 21, in <module>
    init.instantiate_components(framework.get_bundle_context())
  File "/…/ipopo-venv/lib/python3.5/site-packages/pelix/misc/init_handler.py", line 358, in instantiate_components
    with use_ipopo(context) as ipopo:
  File "/usr/lib/python3.5/contextlib.py", line 59, in __enter__
    return next(self.gen)
  File "/…/ipopo-venv/lib/python3.5/site-packages/pelix/ipopo/constants.py", line 208, in use_ipopo
    raise BundleException("No iPOPO service available")
pelix.constants.BundleException: No iPOPO service available

I checked that the bundle context looks like BundleContext(Bundle(ID=0, Name=pelix.framework)), equal to the bundle context in felix.shell where similar API calls are issued.

tcalmant commented 6 years ago

OK, there is something missing in the documentation.

To call instantiate_components(), you must have declared pelix.ipopo.core in the bundles section of the init file.