Sublime Forum

"ESC(BESC" in python build window on OSX

#1

Hi,

When I run a python program in Sublime Text 3 (On OSX 10.9) with Python 2.7, I get some weird characters in build window. I am attaching a screenshot with those characters highlighted. Not a big issue but somewhat distracting.

1 Like

#2

@varunksaini or anyone else, did you find a solution for this? I am having the same issue with ST3 on OS X 10.11 with Python 2.7.

The following prints at the start of every build output from Python and from Ruby (and possibly other build systems):

They appear to be escape characters to move the cursor in the output console. This issue does not occur with ST2 but I rely on some plugins only available to ST3 so I do not wish to change.

0 Likes

#3

https://packagecontrol.io/packages/ANSIescape

0 Likes

#4

Thank you for the response. I suspected this may have been the problem but unfortunately it’s not.

0 Likes

#5

Was a resolution to this ever found? I have been having this problem all year on multiple macOS machines and can’t for the life of me wrap my head around where it’s coming from.

0 Likes

#6

I don’t remember resolving it myself (though this was a while ago now) but somewhere along the line it disappeared.

I would suggest checking you have the latest version of everything (Sublime Text, Anaconda, etc) as I do, but after that I’m out of ideas.

0 Likes

#7

I encountered this issue recently and I found a “solution” (at least working for my case), although I failed to figure out the cause of this issue. For the latest ST3 (i.e., build 3126), I add a check in the on_data() function of exec.py (can be accessed and edited after using PackageResourceViewer to extract and then open) as follows:

        if data == b'\x1b(B\x1b[m':
            print("removing %s" % b'\x1b(B\x1b[m')

After adding this above check the on_data() function is as follows:

def on_data(self, proc, data):
    try:
        if data == b'\x1b(B\x1b[m':
            print("removing %s" % b'\x1b(B\x1b[m')
            data = b''
        characters = data.decode(self.encoding)
    except:
        characters = "[Decode error - output not " + self.encoding + "]\n"
        proc = None

    # Normalize newlines, Sublime Text always uses a single \n separator
    # in memory.
    characters = characters.replace('\r\n', '\n').replace('\r', '\n')

    self.append_string(proc, characters)
0 Likes