Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    zip file extractor

    Scheduled Pinned Locked Moved MicroPython
    7 Posts 2 Posters 52 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K Offline
      kjm
      last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • G Offline
        Gijs
        last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • K Offline
          kjm
          last edited by kjm

          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.

          1 Reply Last reply Reply Quote 1
          • G Offline
            Gijs
            last edited by

            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

            K 1 Reply Last reply Reply Quote 0
            • K Offline
              kjm @Gijs
              last edited by

              @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?

              1 Reply Last reply Reply Quote 0
              • G Offline
                Gijs
                last edited by

                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

                K 1 Reply Last reply Reply Quote 0
                • K Offline
                  kjm @Gijs
                  last edited by

                  @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.

                  1 Reply Last reply Reply Quote 0

                  Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                  Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                  With your input, this post could be even better 💗

                  Register Login
                  • 1 / 1
                  • First post
                    Last post

                  Pycom on Twitter

                  Pycom