Skip to content

import library.zip in memory, with the interface the same as zipimport.

Notifications You must be signed in to change notification settings

zyobi/memzipimport

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Purpose

This module is mostly the same like the builtin module zipimport. While zipimport imports from a zip file, and memzipimport imports from zipped content in memory.

Usage

import sys
sys.memzip = {"library.zip": bytearray(open("lib.zip", "rb").read())}
sys.path.insert(0, "library.zip")
sys.path_hooks.insert(0, memzipimport.zipimporter)

There are three steps:

  • store zipped content in sys.memzip as an bytearray
  • insert a virtual library path
  • insert path hooks

About

import library.zip in memory, with the interface the same as zipimport.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published