Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I work with only PYC files

Tags:

python

I have a program that uses couple of PY files. The code works perfectly till I use the PY files. However, for encryption when I delete the PY files and just keep the PYC files the program fails with message: ImportError: No module named abc

Any ideas/thoughts why python does not like the PYC here when everyting was working fine with the PY files?

like image 613
user741592 Avatar asked Oct 15 '25 14:10

user741592


1 Answers

.pyc files contain byte-compiled python. These can be de-compiled again into very readable python code, and are not a protection from people studying the source code.

If you do want to use this, you need to make sure all files are compiled, use:

python -m compileall /path/to/package

before removing the .py source files.

like image 97
Martijn Pieters Avatar answered Oct 17 '25 04:10

Martijn Pieters