Re: Loading Resources From a Python Module/Package
Paul Moore <[email protected]> Sat, 31 Jan 2015 00:18:30 +0000
| Newsgroups | gmane.comp.python.import |
|---|---|
| Message-ID | <CACac1F_a3DiLpgDV8D-amJCcOwX8mgVOWm8U9EAe_siRSKpwXg@mail.gmail.com> |
On 30 January 2015 at 23:37, Donald Stufft <[email protected]> wrote: > A. What do people think about pkgutil.get_data_filename and > Loader.get_data_filename? Sounds reasonable. It's a relatively rare, but useful use case. One possible issue, though, would people assume that if they get a filename it'd be writeable? For the filesystem loader it would be, but that would break subtly (writes work but would get discarded) for loaders that don't have a native get_data_filename. Related question - how would the temp files be cleaned up? At exit? > B. What do people think about modifying Loader.get_data so it can support > relative filenames instead of the calling code needing to handle that? I'd have to think about that one, but in principle it seems reasonable. While we're extending the loaders, a far more commonly requested feature would be to list available data files. At the moment, code can only load data from known paths, which is not ideal. While it's unrelated to the original proposal, it makes sense if we're changing the spec of loaders to do it in one go, rather than having multiple iterations. Paul