[Python-Dev] Safely importing zip files with C extensions

Vinay Sajip vinay_sajip at yahoo.co.uk
Wed Mar 27 21:41:05 CET 2013


Amaury Forgeot d'Arc <amauryfa <at> gmail.com> writes:


> Better: just put the wheel path to sys.path   
sys.path.append('/tmp/simplejson-3.1.2-cp27-none-linux_x86_64.whl')
> and let a sys.path_hook entry do the job.

That's what the mount() actually does - adds the wheel to a registry that an
import hook uses. You also need a place to check that the wheel being mounted
is compatible with the Python doing the mounting - I'm not sure whether what
the import hook should do if e.g. there is a compatibility problem with the
wheel (e.g. is it clear that it should always raise an ImportError? Or ignore
the wheel - seems wrong? Or do something else?)

Regards,

Vinay Sajip



More information about the Python-Dev mailing list