Skip to content
Advertisement

Trouble with injecting Callable

I’m using python-dependency-injector.

I tried this code and it worked perfectly: https://python-dependency-injector.ets-labs.org/providers/callable.html

that page also mentioned next:

Callable provider handles an injection of the dependencies the same way like a Factory provider.

So I went and wrote this code:

JavaScript

And it — as you might expect — didn’t work. I received this error:

JavaScript

Advertisement

Answer

I ran into this problem too and after much search I found the answer.

You can inject the callable by using the provider attribute:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement