import os
import sys
+import logging
+
+LOGGER = logging.getLogger(__name__)
try:
import py_sg
return data.strip('\x00').split()[1]
except ImportError as e:
- print >>sys.stderr, "hdquery requires py_sg"
+ LOGGER.error("hdquery requires py_sg")
def get_hd_serial_num(device):
raise NotImplemented('get_hd_serial_num is not available for anything other than linux')
#!/usr/bin/env python
-
from optparse import OptionParser
import os
import re
import sys
+import logging
+
+LOGGER = logging.getLogger(__name__)
def main(cmdline=None):
parser = make_parser()
opts.uniform_lengths,
opts.max_errors)
if errors > 0:
- print "%s failed validation" % (filename,)
+ LOGGER.error("%s failed validation", filename)
error_happened = True
stream.close()
def validate_re(pattern, line, line_number, errmsg):
if pattern.match(line) is None:
- print errmsg, "[%d]: %s" % (line_number, line)
+ LOGGER.error("%s [%d]: %s", errmsg, line_number, line)
return 1
else:
return 0
if line_length is None:
line_length = len(line)
elif len(line) != line_length:
- print errmsg, "%d: %s" %(line_number, line)
+ LOGGER.error("%s %d: %s", errmsg, line_number, line)
error_count = 1
return line_length, error_count
run_commands, pathname_to_run_name
from htsworkflow.pipelines.srf import ILLUMINA2SRF10, ILLUMINA2SRF11, SOLEXA2SRF
+LOGGER = logging.getLogger(__name__)
+
def make_parser():
usage = '%prog: [options] runfolder -l 1,2,3 [runfolder -l 5,6 ...]'
runs = runfolder.get_runs(runfolder_path)
# give up if there are anything other than 1 run
if len(runs) > 1:
- print 'ERROR: Too many run directories in %s' %(runfolder_path,)
+ LOGGER.error('Too many run directories in %s', runfolder_path)
return 1
elif len(runs) == 1:
bustard_dir = runs[0].bustard.pathname
opts.dest_dir,
opts.runfolder_version)
else:
- print "ERROR: Couldn't find a bustard directory in", runfolder_path
+ LOGGER.error("Couldn't find a bustard directory in %s",
+ runfolder_path)
return 1
if not opts.dry_run: