--- drmaa/nt.py.orig 2010-05-27 10:25:17 UTC +++ drmaa/nt.py @@ -31,7 +31,7 @@ def namedtuple(typename, field_names, verbose=False): # Parse and validate the field names. Validation serves two purposes, # generating informative error messages and preventing template injection attacks. - if isinstance(field_names, basestring): + if isinstance(field_names, str): field_names = field_names.replace(',', ' ').split() # names separated by whitespace and/or commas field_names = tuple(field_names) for name in (typename,) + field_names: @@ -81,13 +81,13 @@ def namedtuple(typename, field_names, verbose=False): for i, name in enumerate(field_names): template += ' %s = property(itemgetter(%d))\n' % (name, i) if verbose: - print template + print(template) # Execute the template string in a temporary namespace namespace = dict(itemgetter=_itemgetter) try: - exec template in namespace - except SyntaxError, e: + exec(template, namespace) + except SyntaxError as e: raise SyntaxError(e.message + ':\n' + template) result = namespace[typename]