On Oct 2, 7:04 am, Patrick Sabin <patrick.just4...@gmail.com> wrote:
> I use setuptools to create a package. In this package I included some
> images and I checked that they are in the egg-file. The problem is how
> can I access the images in the package?
>
> I tried pkgutil.get_data, but only got an IOError, because the EGG-INFO
> directory doesn't exist.
>
> I tried
> pkg_resources.get_distribution('dist').get_metadata('images/image.png')
> with a similar error (IOError)
>
> What is the best way to access images distributed in an egg file?

The resource_stream(), resource_string(), or resource_filename()
functions:

http://peak.telecommunity.com/DevCenter/PkgResources#basic-resource-access

>
> -Patrick

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to