importing fully qualified scripts to check syntax

horos11 horos11 at gmail.com
Fri Aug 7 22:29:28 CEST 2009


hey all,

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..

So - is there any simple, generic way in python to import a python
file without worrying about naming convention or environment? Sort of
like require in perl?

Ed




More information about the Python-list mailing list