PDA

View Full Version : Difference between .p and .py



gamedesign1
09-05-2016, 06:13 PM
Hi All

Could someone tell me what the different between the .p and .py format is for a Python script.
I am guessing that .p is a compiled version of .py, but I am probably wrong.

If I am right, could someone point me in the right direction of how I compile a Python scrip into a .p format?

Thanks :)

spherical
09-05-2016, 06:38 PM
.pyc files are pre-compiled. Python compiles .py files on the fly. This shortens the startup time, because the file is compiled into bytecode first, but does not change how fast the code runs.

ernpchan
09-05-2016, 09:28 PM
.p files are compiled C plugins. Not python scripts.

To compile your LW python script you need to do it through Layout or Modeler, depending on what environment your script is for.

Ryan Roye
09-06-2016, 07:28 AM
In almost all cases, compiled python scripts (.PYC) run exactly the same as uncompiled python scripts (.PY). The only major difference is that you can open uncompiled scripts in a text editor and edit the script.

The only reason to ever compile your code is if you want to provide users with a plugin, but not reveal the source code you put together. Understand though that python scripts can be de-compiled using tools available online... so you would want to limit who can get their hands on the actual plugin file to reduce the chances of piracy.

gamedesign1
09-11-2016, 01:11 PM
Thanks guys :)