I am trying to load a resource which is present in my project using pkg_resources
but it just throws me an exception saying that it quote "Can't perform this operation for loaders without 'get_data()'". I am not sure if I am doing something wrong here, or if pkg_resources
is somehow broken on python 3.3. I am using python 3.3.3 to be exact. Here is the code I am trying to execute
>>> import pkg_resources
>>> data = pkg_resources.resource_stream('configgenerator', 'schema_rules.yml')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/users/frank/workspace/configgenerator/env/lib/python3.3/site-packages/distribute-0.6.31-py3.3.egg/pkg_resources.py", line 931, in resource_stream
self, resource_name
File "/home/users/frank/workspace/configgenerator/env/lib/python3.3/site-packages/distribute-0.6.31-py3.3.egg/pkg_resources.py", line 1207, in get_resource_stream
return StringIO(self.get_resource_string(manager, resource_name))
File "/home/users/frank/workspace/configgenerator/env/lib/python3.3/site-packages/distribute-0.6.31-py3.3.egg/pkg_resources.py", line 1210, in get_resource_string
return self._get(self._fn(self.module_path, resource_name))
File "/home/users/frank/workspace/configgenerator/env/lib/python3.3/site-packages/distribute-0.6.31-py3.3.egg/pkg_resources.py", line 1289, in _get
"Can't perform this operation for loaders without 'get_data()'"
NotImplementedError: Can't perform this operation for loaders without 'get_data()'
>>>
Does anyone has an idea on how to fix this?
This can happen for a number of reasons, but the the most common is that the package is not an importable module because there is no __init__.py
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With