I used to use perl -c programfile to check the syntax of a Perl program and then exit without executing it. Is there an equivalent way to do this for a Python s
perl -c programfile
import sys filename = sys.argv[1] source = open(filename, 'r').read() + '\n' compile(source, filename, 'exec')
Save this as checker.py and run python checker.py yourpyfile.py.
python checker.py yourpyfile.py