I'd like to create .pyc files and create scripts that will still run only using .pyc files (for sharing the files).
important is that I would also like to use import modules I have created, so it should work to import pyc files or compile all files into one main pyc file.
can I get a short into in how to create those files?
please let me know.. thanks!
if you need to try, 32.10. py_compile — Compile Python source files — Python 2.7.12 documentation
There are many references to this, just search .... create pyc python ... as a search phrase, e.g.
import py_compile py_compile.compile("file.py")
give it whirl with your code, I don't use pyc... the only advantage is for use in a situation where people are working in an environment that would restrict the compilation on their machine. If it for hiding/protecting your code, it will slow down most, but not guarantee it... for that produce a license agreement
Sorry, I've been out of town for work for 2 weeks .. and this week's been busy too.
But thanks for checking back.
The compiling part did work, yes. Though what I ended up using are the automatically generated .pyc files in the same folder. I am not sure why I did not see them being produced in the first place, this is puzzling. It may be a folder refresh issue.
So basically, the structure I'm using now is 1 py file and 1 pyc file, where in the first file I just call a method in the second file, passing on the relevant parameters / user settings.
pyc files are created when a file/module is created. It remains the same unless edits to the underlying script are made, just be aware that if you edit your script from which the pyc was created, that you need to use the new pyc
32.11. compileall — Byte-compile Python libraries — Python 2.7.12 documentation
But note that distributing pycs only won't stop people from being able to see your source code if they want to...