posted by Christopher Roach , updated 1 year ago , 2
I have a build system that I've created for compiling and showing reStructeredText documents. The build system is the following:

    "cmd": ["bash ; pandoc $file -o /tmp/$file_base_name.html ; open /tmp/$file_base_name.html"],
    "selector": "text.restructuredtext",
    "working_dir": "$file_path",
    "shell": true

The problem shows up on line 45 of the exec.py file. Here's the traceback of the error:

Running bash ; pandoc /Users/croach/developer/freshplum/rest/README.rst -o /tmp/README.html ; open /tmp/README.html
Traceback (most recent call last):
  File "./sublime_plugin.py", line 337, in run_
  File "./exec.py", line 154, in run
  File "./exec.py", line 45, in __init__
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0: ordinal not in range(128)

The problem is that my prompt (PS1) uses non-ascii characters and when it's read from os.environ it is already utf-8 encoded and so when trying to encode it as utf-8 in line 45, an error is being thrown.

Hi. I'm one of the maintainers of RubyTest, and this is a serious problem for my users too


Please fix this on priority? This happens because sublime tries to evaluate all shell expressions.


Modifing Packages/Default/exec.py:44 as follows may help:

        for k, v in proc_env.iteritems():
            path_vars = os.path.expandvars(v)
            if isinstance(path_vars, unicode):
                path_vars = path_vars.encode(sys.getfilesystemencoding())
            proc_env[k] = path_vars