Thursday, March 17, 2016

How to compile a PYC file

Compiling and demonstrating a completed piece of code to execute on a double click allows the downloaded user to run the application as long as he/she has any version of the Python IDLE environment installed.

In order to compile a document you must save the file and give it a name of anything you would like.

For example we will name ours PYCompile.py (.py is not needed to be placed at the end as once saved through the IDLE environment it will automatically add this extension.)
Now comes a bit of some trouble.

It is always best to execute this compile based on the documents that are being stored on the Desktop. Python has a very specific set of folders that it will begin to search into and look for the name of your compiled file in order to begin doing work on it. Now in your Python shell you will needed to import the module of py_compile
This imports the .api py_compile from the internet and allows for execution of specific commands.
Next Step
Insert the name of your .py (In this exmaple we using PYCompile.py)
The outputted file will be stored in a __pycache__ folder depending on how your version of Python IDLE was installed originally. (Mine for example gets stored in Documents)

In this folder you will see 'PYCompile.cpython-35.pyc'. This file allows you to launch the application and it will execute the commands in the py file. A little note is once it is compiled it can not be manipulated.

Also that '.cpython-35' at the end of the compiled file indicated the version in which the file was compiled on. Usually users do not leave this attached their file name but it is a helpful piece of information if they had left it attached to their filename.

Good luck.

If you have any questions, comments or concerns feel free to contact me using the form below.

Contact

Talk to us

We aim towards providing excellent service and will response to any comments, questions, concerns or feedback. Feel free to text, email or use the contact form below in to get in touch with us.

Email Address:

DecompileCo@gmail.com

Work Time:

Monday - Friday from 9am to 5pm

Phone/Text

312-300-9818