Re: Loading Resources From a Python Module/Package

Barry Warsaw <[email protected]> Sat, 31 Jan 2015 13:03:21 -0500
Newsgroups gmane.comp.python.import
Organization The Organization of Unorganized Woozalists
Message-ID <20150131130321.31654688@marathon>
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
_______________________________________________
Import-SIG mailing list
[email protected]
https://mail.python.org/mailman/listinfo/import-sig