# HG changeset patch # User Jeff Hammel # Date 1487632281 28800 # Node ID a42a02bb46ed85b60df8021415fc00ca50de9ca2 # Parent 8ae3a7fd466a663c5371a1886e3132f6c72df25d py3 diff -r 8ae3a7fd466a -r a42a02bb46ed martini/config.py --- a/martini/config.py Mon Feb 20 14:56:46 2017 -0800 +++ b/martini/config.py Mon Feb 20 15:11:21 2017 -0800 @@ -4,7 +4,6 @@ import sys - try: from collections import OrderedDict except ImportError: @@ -29,16 +28,24 @@ from io import StringIO +try: + # python 2 + string = (str, unicode) +except: + # python 3 + string = (str,) + + def file_pointer(resource): """returns a file-like object given a string""" # XXX could go in utils.py - if not isinstance(resource, basestring): + if not isinstance(resource, string): # assume resource is already a file-like object return resource if os.path.exists(resource): - return file(resource) + return open(resource) if sum([resource.startswith(http) for http in ('http://', 'https://')]): return urlopen(resource) diff -r 8ae3a7fd466a -r a42a02bb46ed setup.py --- a/setup.py Mon Feb 20 14:56:46 2017 -0800 +++ b/setup.py Mon Feb 20 15:11:21 2017 -0800 @@ -6,7 +6,8 @@ except: description = '' -version = '0.5.2' +version = '0.5.3' + setup(name='martINI', version=version,