importing fully qualified scripts to check syntax
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Fri Aug 7 21:16:06 EDT 2009
En Fri, 07 Aug 2009 17:29:28 -0300, horos11 <horos11 at gmail.com> escribió:
> I'm trying to make a syntax checker, where I say:
>
> python -c "import /path/to/script"
>
> to check the syntax of the script named '/path/to/script' (note: no py
> extension needed). Of course this doesn't work because the
> functionality for import is bundled up with the environment..
Try the py_compile module in the standard library:
http://docs.python.org/library/
The import statement does more than just checking syntax. You may want to
start the interpreter with the -tt option also.
--
Gabriel Genellina
More information about the Python-list
mailing list