faqts : Computers : Management Systems : TCSI : Catalant : Server Development : Python

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

9 of 59 people (15%) answered Yes
Recently 1 of 10 people (10%) answered Yes

Entry

Checking python code for syntax errors

Feb 26th, 2001 14:51
Rathindra Guha, Amedee Potier


The main issue with debugging python scripts is to get rid of the syntax 
errors. They get reported only once  when the corresponding module is 
loaded. 
There is an easy trick to force the checking without running the 
application: 
% cd deploy
% ./run python
>>> import compileall
>>> compileall.compile_dir('.')
That will compile (create pyc files) all the python files found under 
deploy (recursively) and report any error found.