zip file extractor



  • We gather from https://forum.micropython.org/viewtopic.php?t=3094 that there isn't a micropython lib for extracting .zip files. Just thought I'd check that there isn't something in the pycom version of micropython that we might use?



  • @Gijs Yeah, it just occurred to me if there was a compiled version of boot.py on the device I could compare it's size to the gzip size for the same file.



  • Sorry I don't know what you're refering to exactly. You're looking for a compiled version of the python files on the device? I'm not sure how it works



  • @Gijs I don't see any .pyc files on the gpy Gijs. Does the interpreter not make them when it interprets boot.py into ram for execution? I was thinking if I could get my hands on a .pyc version of my user code it would presumably have comments stripped out & I could upload that as an alternative to zlib or gzip?



  • Great to hear it works for you as well :) There's also different options to play with for compression ratio etc, but we haven't quite figured that out



  • tnx Gijs, compressed a 40k .py file with zlib in python 3.9 on my PC down to a 10k .zlib &, once I substituted uzlib for zlib in the pycom device code from the tutorial you linked, the gpy extracted it. The gzip example also extracted a .gzip file made with 7zip in Windows10 (had to use the folder name in lieu of the file name). Spoilt for choice now.



  • As mentioned in the thread, there is the uzlib module. We tried to make some more comprehensive examples for that here: https://docs.pycom.io/tutorials/advanced/uzlib/. To answer your question, I do not think it works for normal .zip files, but it is able to decompress zlib and gzip files.


Log in to reply
 

Pycom on Twitter