Compile without execute for syntax check?

Bernhard Reiter breiter at usf.Uni-Osnabrueck.DE
Tue Mar 14 09:11:08 EST 2000


In article <8aju81$cm6$1 at nntp6.atl.mindspring.net>,
	aahz at netcom.com (Aahz Maruch) writes:
> In article <8a3437$er1$1 at newsserver.rrzn.uni-hannover.de>,
> Bernhard Reiter <breiter at usf.Uni-Osnabrueck.DE> wrote:
>>
>>The python interpreter in the non inspecting mode(default) finds
>>some python syntax errors directly before running the code.
>>
>>Call me old fashioned, but the documentation is not clear about how
>>to use this build-in syntax check on scripts without executing them.
>>Nothing in the FAQ ether.

> See FAQ entry 4.49, sort of.  
Well I read that of course. ;-)

> What that doesn't tell you is that simply
> doing an import of a module will produce the .pyc (and incidentally
> perform the syntax check you request).  

True. It also does not tell about py_compile.compile() which will not run
the script as import will.

> I may write a FAQ entry explaining this in a bit more detail.
I would have suggested one but was not sure myself what the best way is.
	Bernhard
-- 
Professional Service around Free Software                (intevation.net)  
The FreeGIS Project				            (freegis.org)
Association for a Free Informational Infrastructure            (ffii.org)



More information about the Python-list mailing list