[ckan-dev] Paths to resources within eggs
James Gardner
james at 3aims.com
Sat Mar 12 17:45:13 UTC 2011
As Rufus said, using zip_safe=False fixes this but also you can also get
the files from an egg if you ever really need to:
from pkg_resources import resource_string
print resource_string('ckan', 'migration/migrate.cfg')
This extracts a copy to a temp file and returns it's contents. See this
for more info:
http://peak.telecommunity.com/DevCenter/PythonEggs#accessing-package-resources
James
On 07/03/11 14:35, Rufus Pollock wrote:
> On 4 March 2011 09:25, Seb Bacon<seb.bacon at gmail.com> wrote:
>> Hi,
>>
>> I'm referring to template and css resources that are inside a package, thus:
>>
>> https://bitbucket.org/sebbacon/ckanext-datagm/src/b6e670e77e92/ckanext/datagm/__init__.py#cl-28
>>
>> This works as long as I'm using develop eggs, but if I use zipped
>> eggs, of course it breaks.
> Don't use zipped eggs (ever!). Set zip_safe=False in setup.py (it
> should be set by default and if not we should fix the paster command
> that creates extensions from a template).
>
> Rufus
>
>> Can someone with more egg-fu than me suggest what a solution is to
>> distributing resources like this might look like?
>>
>> Thanks,
>>
>> Seb
>>
>> _______________________________________________
>> ckan-dev mailing list
>> ckan-dev at lists.okfn.org
>> http://lists.okfn.org/mailman/listinfo/ckan-dev
>>
>
>
More information about the ckan-dev
mailing list