From: Paul Sokolovsky <[email protected]> > Which makes everyone in the audience wonder: how it happens that it's > 2015, Python is at 3.5, but pkgutil.get_data() is in stdlib, while> > pkg_resources.resource_stream() isn't? An implementation of > pkgutil.get_data() would be based on pkg_resources.resource_stream(), > or would contain just the same code as the latter, so it could easily >be exposed, and yet it isn't. Perhaps because it's not always that way around - pkg_resources.get_stream_resource, in relevant cases, returns a BytesIO which wraps a byte string. If you want a stream, you could just as easily do this yourself by calling io.BytesIO(pkg_util.get_data('foo.pkg', 'foo_resource')). In the case of file resources only, pkg_resources.get_stream_resource can open the file and return the stream directly. But this is an optimisation and is not always necessarily available for all different loader implementations - which is perhaps why a `pkgutil.get_data_stream` is not provided. Regards, Vinay Sajip
_______________________________________________ Distutils-SIG maillist - [email protected] https://mail.python.org/mailman/listinfo/distutils-sig
