I understand how we can package an .exe by pointing PyInstaller to a file. Such like:
c:\Python25\python c:\Users\Mike\Desktop\pyinstaller-1.4\Makespec.py -F -w sampleApp.py
However is there a way to create an .exe with only a string [and not a file]? Such as:
string="""
print "Hello world"
"""
buildApplication(string) #Function Does not exist
To the best of my knowledge, I am afraid you won’t be able to work around the need to create a temporary file with any of the existing standalone executable creation tools (py2exe, PyInstaller and cxFreeze).
What I see as the most viable solution is a bit of security through obscurity, combining the following two techniques:
.pyc) directly, instead of the plaintext.pyfile, from the generated code string, using the__builtin__.compilefunction (you can find on the source code of the py_compile module how to achieve this. A byte-compiled file will be significantly less useful to prying eyes than the source file.