use six.moves to work around urllib / urllib2 / urlparse to urllib 2to3 cleanup
[htsworkflow.git] / encode_submission / geo_gather.py
index f9b07ab775a4491226db9c9b97215ea82f7cc54e..46d7635d2f8e319fe12b9e49b090b66a741c47db 100644 (file)
@@ -1,4 +1,6 @@
 #!/usr/bin/env python
+from __future__ import print_function, unicode_literals
+
 from ConfigParser import SafeConfigParser
 import fnmatch
 from glob import glob
@@ -9,14 +11,11 @@ from optparse import OptionParser, OptionGroup
 import os
 from pprint import pprint, pformat
 import shlex
-from StringIO import StringIO
+from six.moves import StringIO
 import stat
 import sys
 import time
 import types
-import urllib
-import urllib2
-import urlparse
 from zipfile import ZipFile
 
 import RDF
@@ -69,7 +68,10 @@ def main(cmdline=None):
 
     results = ResultMap()
     for a in args:
-        results.add_results_from_file(a)
+        if os.path.exists(a):
+            results.add_results_from_file(a)
+        else:
+            logger.warn("File %s doesn't exist.", a)
 
     if opts.make_tree_from is not None:
         results.make_tree_from(opts.make_tree_from)
@@ -95,7 +97,7 @@ def main(cmdline=None):
 
     if opts.print_rdf:
         writer = get_serializer()
-        print writer.serialize_model_to_string(model)
+        print(writer.serialize_model_to_string(model))
 
 
 def make_parser():