Alex Goft
Alex Goft

Reputation: 380

replace all py files with pyc files in directory

I want to be able to ship only the .pyc files so I achieve lightweight/basic obfuscation in my shipped application.

I tried the command line -

python -m compileall -f C:\MOT_Server\olympus-skeleton\dist\olympus_server

But all py files remain.

I wish that every py file will be replaced with pyc file, and not that all pyc files will be dumped to __pycache__ folder.

Upvotes: 5

Views: 1580

Answers (1)

Marcin Orlowski
Marcin Orlowski

Reputation: 75619

You have to get rid of .py files yourself, but find shall be useful for that:

find . -type f -name "*.py" -exec rm -f {} \;

Note: it will go recursive!

If you are unfamiliar with find, remove -exec ... part for testing to have all "qualified" files printed out:

find . -type f -name "*.py"

Upvotes: 2

Related Questions