how to improve simple python shell script (to compile list offiles)
fredrik at pythonware.com
Sat Oct 15 22:11:40 CEST 2005
Jari Aalto wrote:
> Thanks, but that will not work. The files are gathered from discrete
really? so what is that "find" command doing in your code ?
compile $(find path/to -type f -name "*.py")
seems to me as if
python -mcompileall path/to
would do exactly what your script does...
(if you really think that find does something that compileall or os.walk
cannot do, you can fix your script by fixing the identation. the quickest
way to do that is to insert an if-statement:
function compile ()
python -c '
if 1: # python code has to start in column 0
import os, sys, py_compile
i = 0
More information about the Python-list