Skip to content

Commit

Permalink
fix #200 'keywords must be strings' error on OSX < 10.7 (with python …
Browse files Browse the repository at this point in the history
…< 2.6.6)
  • Loading branch information
wuub committed Jul 9, 2013
1 parent 94af85e commit ab020c6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions sublimerepl.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@
from . import repls
from .repllibs import PyDbLite
unicode_type = str
PY2 = False
except ImportError:
import sublimerepl_build_system_hack
import repls
from repllibs import PyDbLite
import Queue as queue
unicode_type = unicode
PY2 = True

PLATFORM = sublime.platform().lower()
SETTINGS_FILE = 'SublimeREPL.sublime-settings'
Expand Down Expand Up @@ -533,13 +535,20 @@ def _subst_for_translate(window):
project_settings = sublimerepl_build_system_hack.get_project_settings(window)
res.update(project_settings)

# see #200, on older OSX (10.6.8) system wide python won't accept
# dict(unicode -> unicode) as **argument.
# It's best to just str() keys, since they are ascii anyway
if PY2:
return dict((str(key), val) for key, val in res.items())

return res

@staticmethod
def _translate_string(window, string, subst=None):
from string import Template
if subst is None:
subst = ReplManager._subst_for_translate(window)

return Template(string).safe_substitute(**subst)

@staticmethod
Expand Down

0 comments on commit ab020c6

Please sign in to comment.