From 96833cdd527fe260ed6f9aee22c56ed973c5ef3c Mon Sep 17 00:00:00 2001 From: Diane Trout Date: Wed, 16 Sep 2009 21:36:36 +0000 Subject: [PATCH] Replace some prints with logging.info messages and replace the call to HTTPError.reason with HTTPError.code and HTTPError.msg as those seem to be available in python 2.6 --- htsworkflow/pipelines/retrieve_config.py | 13 ++++++------- scripts/retrieve_config | 2 ++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/htsworkflow/pipelines/retrieve_config.py b/htsworkflow/pipelines/retrieve_config.py index 13805c9..e9745a3 100644 --- a/htsworkflow/pipelines/retrieve_config.py +++ b/htsworkflow/pipelines/retrieve_config.py @@ -128,12 +128,11 @@ def getCombinedOptions(): if conf_parser.has_option('local_setup', 'genome_dir'): options.genome_dir = conf_parser.get('local_setup', 'genome_dir') - print 'USING OPTIONS:' - print ' URL:', options.url - print ' OUT:', options.output_filepath - print ' FC:', options.flowcell - print 'GDIR:', options.genome_dir - print '' + logging.info('USING OPTIONS:') + logging.info(' URL: %s' % (options.url,)) + logging.info(' OUT: %s' % (options.output_filepath,)) + logging.info(' FC: %s' % (options.flowcell,)) + logging.info('GDIR: %s' % (options.genome_dir,)) return options @@ -150,7 +149,7 @@ def saveConfigFile(flowcell, base_host_url, output_filepath): try: web = urllib2.urlopen(url) except urllib2.URLError, e: - errmsg = 'URLError: %s' % (e.reason,) + errmsg = 'URLError: %d %s' % (e.code, e.msg) logging.error(errmsg) logging.error('opened %s' % (url,)) raise IOError(errmsg) diff --git a/scripts/retrieve_config b/scripts/retrieve_config index 3fab6ad..c765da9 100644 --- a/scripts/retrieve_config +++ b/scripts/retrieve_config @@ -1,4 +1,5 @@ #!/usr/bin/env python +import logging import sys from htsworkflow.pipelines.retrieve_config import * from htsworkflow.pipelines import retrieve_config @@ -49,4 +50,5 @@ def main(args=None): return 0 if __name__ == "__main__": + logging.basicConfig(level=logging.INFO) sys.exit(main(sys.argv[1:])) -- 2.30.2