Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
===================================================

"""

from __future__ import print_function
import sys
from os import path, mkdir
from inspect import getargspec
Expand Down Expand Up @@ -163,7 +163,7 @@ def _impl(v):
self.__struct = self.__struct(
Configuration.from_dict({}, pwd=self._pwd))

for k, v in self.iteritems():
for k, v in self.items():
self[k] = _impl(v)

return self
Expand Down Expand Up @@ -560,9 +560,12 @@ def import_string(import_name, silent=False):
modname = module + '.' + obj
__import__(modname)
return sys.modules[modname]
except ImportError, e:
except ImportError as e:
if not silent:
raise ImportStringError(import_name, e), None, sys.exc_info()[2]
if sys.version_info.major == 2:
exec("raise ImportStringError(import_name, e), None, sys.exc_info()[2]") # Get around SyntaxError in Py3

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Came here to submit exactly the same patch. Minor note here -- you could replace this whole if/else block with

six.reraise(ImportStringError, ImportStringError(import_name, e), sys.exc_info()[2])

assuming you've imported six and added it to the dependencies in setup.py

else:
raise ImportStringError(import_name, e).with_traceback(sys.exc_info()[2])

class ImportStringError(ImportError):
"""Provides information about a failed :func:`import_string` attempt.
Expand Down Expand Up @@ -621,7 +624,7 @@ def format_config(config, _lvl=0):
return buf

def print_config(config):
print format_config(config)
print(format_config(config))

def obj_by_ref(o, path):
for s in path.split("."):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from setuptools import setup

version = "0.5"
version = "0.6"

with open('README') as f:
long_description = f.read()
Expand Down