# HG changeset patch # User Jeff Hammel # Date 1487631406 28800 # Node ID 8ae3a7fd466a663c5371a1886e3132f6c72df25d # Parent 5de4f7d434dec0f246df97229f492aeb1eacdee6 py3 diff -r 5de4f7d434de -r 8ae3a7fd466a martini/config.py --- a/martini/config.py Mon Feb 20 14:50:23 2017 -0800 +++ b/martini/config.py Mon Feb 20 14:56:46 2017 -0800 @@ -2,19 +2,32 @@ import os import sys -import urllib2 -from ConfigParser import ConfigParser -from ConfigParser import InterpolationMissingOptionError -from ConfigParser import MissingSectionHeaderError -from ConfigParser import NoOptionError -from StringIO import StringIO + try: from collections import OrderedDict except ImportError: from odict import OrderedDict +try: + # python 2 + from urllib2 import urlopen + from ConfigParser import ConfigParser + from ConfigParser import InterpolationMissingOptionError + from ConfigParser import MissingSectionHeaderError + from ConfigParser import NoOptionError + from StringIO import StringIO + +except ImportError: + # python 3 + from urllib.request import urlopen + from configparser import ConfigParser + from configparser import InterpolationMissingOptionError + from configparser import MissingSectionHeaderError + from configparser import NoOptionError + from io import StringIO + def file_pointer(resource): """returns a file-like object given a string""" @@ -28,7 +41,7 @@ return file(resource) if sum([resource.startswith(http) for http in ('http://', 'https://')]): - return urllib2.urlopen(resource) + return urlopen(resource) return StringIO(resource) diff -r 5de4f7d434de -r 8ae3a7fd466a setup.py --- a/setup.py Mon Feb 20 14:50:23 2017 -0800 +++ b/setup.py Mon Feb 20 14:56:46 2017 -0800 @@ -6,7 +6,7 @@ except: description = '' -version = '0.5.1' +version = '0.5.2' setup(name='martINI', version=version,