Replace some prints with logging.info messages and
authorDiane Trout <diane@caltech.edu>
Wed, 16 Sep 2009 21:36:36 +0000 (21:36 +0000)
committerDiane Trout <diane@caltech.edu>
Wed, 16 Sep 2009 21:36:36 +0000 (21:36 +0000)
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
scripts/retrieve_config

index 13805c9514db7810f6c0c74671ff2c8afa424b6a..e9745a377fe2bed0c9a14789e630409b799e95c3 100644 (file)
@@ -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)
index 3fab6ad2513a74dc79c036d7e56cb17b52ebd3e9..c765da941050076c4c8787c13d0499b80452a74a 100644 (file)
@@ -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:]))