The py_compile module provides a function to generate a byte-code file from a source file, and another function used when the module source file is invoked as a script.
Though not often needed, this function can be useful when installing modules for shared use, especially if some of the users may not have permission to write the byte-code cache files in the directory containing the source code.
|file[, cfile[, dfile[, doraise]]])|
'o'if optimization is enabled in the current interpreter). If dfile is specified, it is used as the name of the source file in error messages instead of file. If doraise = True, a PyCompileError is raised when an error is encountered while compiling file. If doraise = False (the default), an error string is written to sys.stderr, but no exception is raised.
When this module is run as a script, the main() is used to compile all the files named on the command line.