How to Edit PYO & PYC Files
By Michael Butler
Updated September 28, 2017
PYC and PYO files are compiled Python code designed to load scripts faster than standard .py files. Because they are compiled programs, you cannot edit them directly. To edit them, you need to use the source code on which they were built. You can use online tools to decompile the files for editing.
Locate a .py file on your computer with the same filename as the .pyo or .pyc file. The .py file is the original script. Open the file in a text editor, such as Notepad, to make the edits you want.
Go to Crazy-compilers.com and use the free Decomplye tool. This tool can decompile your Python scripts up to version 2.6. As of the date of publication, the service costs 10 Euros per every 5KB. After you upload the file to the service, it will decompile the file and send it to your email address.
Go to Depython.net and upload your .pyo or .pyc files for free. The service instantly decompiles your script and makes it available for download. DePython works with scripts up to Python version 2.5.
Compiled Python scripts do not run faster. They only load faster. In most circumstances, you do not need to compile your Python scripts into .pyc or .pyo files.
A professional writer, Michael Butler has been writing Web content since 2010. Butler brings expertise in legal and computer issues to his how-to articles. He has a Bachelor of Arts in English literature from Washburn University. Butler also has a Juris Doctor from Indiana University School of Law, Bloomington.