Open leetschau opened 5 years ago
Do you open the .pyz file? Does it contain mylib.pye?
@Falldog Yes, mylib.pye is in add_cols.pyz, which is just a plain zip file:
$ unzip -l add_cols.pyz
Archive: add_cols.pyz
Length Date Time Name
--------- ---------- ----- ----
352 01-21-2019 16:19 mylib.pye
231 01-21-2019 16:20 app.py
46 01-23-2019 15:00 __main__.py
--------- -------
629 3 files
I have a trivial implementation that allows pye files in a zip package. I tested with python 3.10 on Windows 11, the zip package contains 100+ pye files in complex directory structure and everything works just like pyc files (a bit slower though). The package has to end with .zip extension (as the regex use it to parse the file path) but you can make changes to support other format. My fork: https://github.com/coldfire0200/pyconcrete/tree/master/src/pyconcrete
Basically in the original code, exists function is used to check file existence and open function is used to open file. This would work with regular file system but not files within a zip package. In my implementation when the file path contains .zip file the check existence and file read are handled differently (using the ZipFile operations).
I do agree with other discussion that at least PyeLoader should be built as binary (Cython?) to make it a little bit more difficult to get the decrypted pyc file.
@coldfire0200 awesome work! PullRequest is welcome, if it could contain more test-cases would be better If you just left fork here, I will spent some time to add the test-case and merge it later, maybe it will take time, lol.
I do agree with other discussion that at least PyeLoader should be built as binary (Cython?) to make it a little bit more difficult to get the decrypted pyc file.
Agree, it would be a new topic for next steps
@coldfire0200 awesome work! PullRequest is welcome, if it could contain more test-cases would be better If you just left fork here, I will spent some time to add the test-case and merge it later, maybe it will take time, lol.
I do agree with other discussion that at least PyeLoader should be built as binary (Cython?) to make it a little bit more difficult to get the decrypted pyc file.
Agree, it would be a new topic for next steps
Thanks I will spend some time writing test cases this weekend.
zipapp makes multiple Python files as a bundle to be easy distributed. However when the pye file is bundled into the zipapp, it can't be found. Here is a minimal demo:
Environment:
I have no experience in C/C++, and can not make more debuggings.
Thanks for help.