-
Notifications
You must be signed in to change notification settings - Fork 87
Unable to run the basic dependency injection example mentioned in documentation. #41
Comments
Happened to me as well.. anyone? |
me too. ubuntu: 18.04 |
Same.
Here is a quick hack that seems to get the job done in pinject/finding.py def find_classes(modules, classes):
if classes is not None:
all_classes = set(classes)
else:
all_classes = set()
for module in _get_explicit_or_default_modules(modules):
# TODO(kurts): how is a module getting to be None??
if module is not None and str(module).find('six.moves') == -1:
all_classes |= _find_classes_in_module(module)
return all_classes |
I have been using this hack for testing a new version of a backend solution which uses pinject for the past several months. So far we have had no issues with it but I am hesitant to send something like this into production. I may have time to properly address this in December. If the algorithm has a bug I will try and fix it. If assumptions made by the algorithm are violated by six I will see if I can accommodate them. Otherwise a module blacklist might be the only solution which could be done in a reasonable amount of time. |
Hey guys. I was with the same problems. When you use obj_graph = pinject.new_object_graph() by default looks in all imported modules, but you may occasionally want to restrict the classes for which new_object_graph() creates implicit bindings. If so, new_object_graph() has two args for this purpose. So, you can use: This resolved my problem :) |
Either the error message should be changed to something more precise, since the issue may be caused by not providing the modules arg, or the factory function should default to the modules arg being None-type so that it doesn't occur. |
Issue Description:
Unable to run the example mentioned in the documentation (https://github.com/google/pinject) of pinject. Getting
ModuleNotFoundError: No module named '_gdbm'
.I've installed
python-gdbm
through conda but still, I see the ModuleNotFoundError. Could you please help me to understand what could be the issue?Code:
Error Log Trace:
The text was updated successfully, but these errors were encountered: