From e28107578761c7bf719742ce54442ff5d0914b21 Mon Sep 17 00:00:00 2001 From: Brian Dolbec Date: Sat, 16 Nov 2013 12:00:27 -0800 Subject: [PATCH] fix attribute error for newer pythons --- gkeys/utils.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gkeys/utils.py b/gkeys/utils.py index 0cbcdea..b1fb69b 100644 --- a/gkeys/utils.py +++ b/gkeys/utils.py @@ -22,11 +22,18 @@ Utility functions''' -import types, re, os +import types +import re +import os import sys import locale import codecs +try: + StringTypes = types.StringTypes +except AttributeError: + StringTypes = [str] + def encoder(text, _encoding_): return codecs.encode(text, _encoding_, 'replace') @@ -132,7 +139,7 @@ def path(path_elements): ''' pathname = '' - if type(path_elements) in types.StringTypes: + if type(path_elements) in StringTypes: path_elements = [path_elements] # Concatenate elements and seperate with / -- 2.26.2