Re: Loading Resources From a Python Module/Package

Donald Stufft <[email protected]> Sat, 31 Jan 2015 13:09:03 -0500
Newsgroups gmane.comp.python.import
Message-ID <[email protected]>
> On Jan 31, 2015, at 1:05 PM, PJ Eby <[email protected]> wrote:
> 
> On Sat, Jan 31, 2015 at 12:44 PM, Barry Warsaw <[email protected]> wrote:
>> On Jan 30, 2015, at 07:52 PM, Donald Stufft wrote:
>> 
>>>> On Jan 30, 2015, at 7:18 PM, Paul Moore <[email protected]> wrote:
>>>> Related question - how would the temp files be cleaned up? At exit?
>>> 
>>> My patch registers an atexit handler that cleans up the temporary files yea.
>> 
>> Why not implement it as a context manager?
> 
> Note that neither approach will work for one common use of extracted
> files: extension modules and shared libraries on Windows.  Unlike
> *nixy operating systems, you can't delete an open file on Windows, and
> loaded .DLLs are open files IIUC.  Unless you've got some way to
> unload the .pyd or .dll files, you won't be able to do a complete
> cleanup in that case.  (This use case is actually why I took the
> caching approach rather than the tempfile approach in the first
> place.)

I don’t think it’s important for this API to support extracting extension
modules. If we want to support importing extension modules from inside
of a zip file (or similar) I think that should get it’s own support inside
the loader and not rely on the resource extraction for that. IOW I think
that these should primarily exist for data files.

---
Donald Stufft
PGP: 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA

_______________________________________________
Import-SIG mailing list
[email protected]
https://mail.python.org/mailman/listinfo/import-sig