maltize / sublime-text-2-ruby-tests

Sublime Text 2 plugin for running ruby tests! (Unit, RSpec, Cucumber)
722 stars 119 forks source link

UnicodeDecodeError: 'ascii' codec can't decode #116

Open AvnerCohen opened 12 years ago

AvnerCohen commented 12 years ago

Running on Mac 10.8.1, A fresh install of RubyTest with Sublime Text 2 (Build 2217), I'm getting the following:

Running rspec spec/models/user_spec.rb -l10 Traceback (most recent call last): File "./sublimeplugin.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 60: ordinal not in range(128) reloading /Users/xxx/Library/Application Support/Sublime Text 2/Packages/User/RubyTest.last-run

Any suggestions on what to check next?

Thanks.

gja commented 12 years ago

It's something to do with environment variables that are set, and sublime trying to reinterpret it.

Is there some environment variable you have set that has unicode in it?

gja commented 12 years ago

Sorry, didn't mean to close the issue

AvnerCohen commented 12 years ago

Thanks for the reply. There could be something like that, not sure. Is there a way for me to locally add a debug statements to pin point what is causing this or at least isolate it somehow?

gja commented 12 years ago

Press control-` to get the test console. And type the following:

import os; os.environ

What is the output from that

On Sun, Sep 9, 2012 at 3:45 PM, AvnerCohen notifications@github.com wrote:

Thanks for the reply. There could be something like that, not sure. Is there a way for me to locally add a debug statements to pin point what is causing this or at least isolate it somehow?

— Reply to this email directly or view it on GitHubhttps://github.com/maltize/sublime-text-2-ruby-tests/issues/116#issuecomment-8402349.

AvnerCohen commented 12 years ago

@gja Many thanks for your help! The was what I needed to find the problem I'm using Zack Holmans .dotfiles and you can see in the following script: https://github.com/holman/dotfiles/blob/master/zsh/prompt.zsh

The set of:

export PROMPT=$'\n$(rb_prompt) in $(directory_name) $(git_dirty)$(need_push)\n› '

Which is the issue here.

Not sure if this should be fixed in RubyTest or Sublime core, locally I will of course remove the newline char. Thanks again. Let me know if you need anything further.

gja commented 12 years ago

This is surely an issue in Sublime Core. Does anyone know how to reach the author of sublime?

On Mon, Sep 10, 2012 at 12:46 AM, AvnerCohen notifications@github.comwrote:

@gja https://github.com/gja Many thanks for your help! The was what I needed to find the problem I'm using Zack Holmans .dotfiles and you can see in the following script: https://github.com/holman/dotfiles/blob/master/zsh/prompt.zsh

The set of:

export PROMPT=$'\n$(rb_prompt) in $(directory_name) $(git_dirty)$(need_push)\n› '

Which is the issue here.

Not sure if this should be fixed in RubyTest or Sublime core, locally I will of course remove the newline char. Thanks again. Let me know if you need anything further.

— Reply to this email directly or view it on GitHubhttps://github.com/maltize/sublime-text-2-ruby-tests/issues/116#issuecomment-8408141.

gja commented 12 years ago

I've bumped an issue with Sublime Core http://sublimetext.userecho.com/topic/120265-non-ascii-character-bug-in-build-system-using-shell-true/?comment_form_activate=true

AvnerCohen commented 12 years ago

Cool. In any case, this probably shouldn't remain open, many thanks for the help!

Eventect commented 12 years ago

Hey,

FYI I was having the same problem and I solved it using this trick: http://www.sublimetext.com/forum/viewtopic.php?f=3&t=8512

AvnerCohen commented 12 years ago

Cool! worked for me.

I wonder why not more people are facing it, How rare could the combination of multiline prompt + RubyTest be?

vladipus commented 11 years ago

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
gja commented 11 years ago

Actually, this should be open till upstream fixes it

wikichen commented 11 years ago

:+1: for @vladipus's comment (the fix will have to do for now)

amiel commented 11 years ago

@vladipus's hack worked for me

jareddbc commented 11 years ago

10 months and this still isn't fixed? :(

fobdy commented 10 years ago

Have the same issue

OS X 10.9 SublimeText 3

Exception in thread Thread-16:
Traceback (most recent call last):
  File "X/threading.py", line 639, in _bootstrap_inner
  File "Modific in /Users/fbd/Library/Application Support/Sublime Text 3/Installed Packages/Modific.sublime-package", line 115, in run
  File "X/subprocess.py", line 906, in communicate
  File "X/subprocess.py", line 1531, in _communicate
  File "X/subprocess.py", line 831, in _translate_newlines
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 215: ordinal not in range(128)
gja commented 10 years ago

@jareddbc Sorry, this isn't in our control. This is a bug in Sublime Text :-(. We've raised issues with the developer, but it's been ignored for the longest time. See my earlier comment.

cartazio commented 10 years ago

how can this be patched by myself in my mac?

gja commented 10 years ago

@cartazio see the patch linked to by @Eventect

cartazio commented 10 years ago

i just pull requested a better patch :)