[Import-SIG] Loading Resources From a Python Module/Package

Barry Warsaw barry at python.org
Sat Jan 31 19:03:21 CET 2015


On Jan 31, 2015, at 02:48 PM, Brett Cannon wrote:

>> 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.
>
>I don’t think you can assume it’s writeable since that’ll break in a lot
>of common cases even with the filesystem loader since often times things
>in the filesystem will be installed in the system and users won’t have
>permissions to write to them anyways.

That's okay.  Just let the normal exceptions percolate up.

But I do agree that at least in my own use cases, these are almost entirely
read operations, so I'm okay with enforcing that.  I think a user could pretty
easily implement writable APIs on top if needed.

Cheers,
-Barry


More information about the Import-SIG mailing list