ArchiveImporter
ArchiveImporter copied to clipboard
Import Packages from password Protected zip.
@Dakkaron I am trying to use ArchieveImporter to import a package which has further subpackages from a password protected zip but I am unable to handle .pyd files in it, any idea how can we resolve this issue?
From what I can see, .pyd files are Windows specific. Since I am a Linux dev, I haven't tested it with .pyd files, but it shouldn't be that hard.
Do you have a sample file that I can test it with?
@Dakkaron Just to give you some background of what I have done so far:
- With the original implementation of ArchieveImporter, we are going into infinite recursion(when init.py imports package.subpackage) while importing any package from zip. In order to resolve this, I placed 'sys.modules[fullname] = newModule' before 'exec(data, newModule.dict)', it seems to work but I have no idea of it's repercussions.
- In order to list .pyd files I added 'modlist += [ x[:-4] for x in namelist if x.endswith(".pyd")]' into getModlist method similarly a line can be added for .so files in case of linux. You can test it with any .so file instead .pyd that you have.
Now the problem I am running into is exec() does not like content of .pyd (not sure about .so, I have not tested it). I tried searching importlib module of python to see how Python initializes .pyd file but without luck.
Any guidance at this point will be helpful.