Updated python to respect environment
Updated python script to report errors.