[Help] Using Pack on Package #2068
Replies: 3 comments 4 replies
-
|
How about this command? |
Beta Was this translation helpful? Give feedback.
-
|
Remove output first, also check this page |
Beta Was this translation helpful? Give feedback.
-
|
@jondy I am still working on this. I am thinking it might be a PyInstaller issue. I can see from the terminal output that the non-working case misses processing I believe this PyInstaller function is not getting called or is somehow not working for the test case. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello-
I am having an issue with using the Pack command that I am not able to understand from the documentation. I hope that someone can please explain the limitations to me more clearly, since after reading the documentation I am still confused.
My environment
--packcommand to let PyArmor help me package this. I would try this code:However, this leads to an error. As best as I can tell, PyInstaller does not allow you to pass in a package. It needs a script file as an entry point.
Question 1 Is this correct, that PyArmor can accept a package, but PyInstaller cannot, therefore in this case the user cannot autopack with PyArmor?
Assuming this is correct, I would either need to create a spec file, or find a way to pass in a script file instead of the package.
Making a manual spec file seems like a lot of extra work to manage, I would like to not have to chase down every hidden import.
I would like to rely on PyArmor for this. So I can try the following command:
My Project structure looks like this:
When I call:
My obfuscated code lands here:
And the packaged file lands here:
If I call
python .pyarmor/pack/dist/main.pyI will receive this errorI am guessing this is because my project uses absolute imports, so everything is imported as
app.package.submodule. However, after obfuscation, all of the files land in adist/and they are no longer inapp/. I have not changed everything to relative imports to check. I would prefer to keep the absolute imports.Question 2 Is the fact that the obfuscated code is no longer in
app/and is now indist/what is causing these import errors?.\dist\main.exeto run the final packaged file. However, I receive this errorI have read the
4.2. Understanding Obfuscated Script, but I do not see what is relevant. I also note that--prefixand-iconflict with--pack. So it seems like there should be no other options required.Question 3 Am I correct that no other commands should be necessary for this application?
pyarmor gen --recursive --expired 7 --pack app/main.py. I noticed when running the obfuscated code directly frompython .\.pyarmor\pack\dist\main.pyI received the same errorModuleNotFoundError: No module named 'app'. However when running the EXE it was OK. Not being able to run the obfuscated code pre-packaging is OK.Question 4 Given the import structure, is this the expected behavior that the obfuscated code cannot be run?
Question 5 Does this seem like the culprit for this issue? Is there any other steps I can try to narrow this down?
Beta Was this translation helpful? Give feedback.
All reactions