command = "python -c \"import sys; sys.stderr = sys.stdout; import non_existent; print 'asdf'\"" ;
output = [ SHELL $(command) : strip-eol ] ;
echo ------------------------ ;
echo $(output) ;
echo ------------------------ ;
exit : 0 ;
Which will output the following:
------------------------
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named non_existent
------------------------
That's about the best I could come up with at the moment.
It would probably be cleaner, though, to just create a script and do all of your setup/checking in there and just call out to that script to perform the configuration.