sublimerepl getenv failing [英] sublimerepl getenv failing

查看:1888
本文介绍了sublimerepl getenv failing的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用带有Sublime Text的SiblimeREPL软件包。当我尝试启动一个REPL,我得到

  SublimeREPL:getenv()获得sane环境失败
检查控制台和'getenv_command'设置
WARN:回退到SublimeText环境

REPL我试着开始。 (我试过Ruby,Python和Clojure。)我尝试Sublime Text 2和Sublime Text 3具有相同的结果。这是在Mac OS X,如果这很重要。



我查看了包设置,我看到

 getenv_command:[/ bin / bash,--login,-c,env],
/ pre>

如果我在终端提示符处运行/ bin / bash --login -c env,我会列出我的环境。



为了获得成功的getenv_command,我需要改变什么?

解决方案

与ssgam相同的问题。我的问题行是在getenv方法。它调用 subprocess.check_output(getenv_command),它不存在于python 2.6,ST2似乎使用。



诀窍是,它只调用subprocess.check_output()如果getenv_command是真的,否则默认为os.environ.copy()。因此,要在不修改SublimeREPL软件包的情况下,在偏好设置>软件包设置> SublimeREPL>设置 - 用户中进行修改,请执行以下操作:

  {
getenv_command:false
}


I'd like to use the SiblimeREPL package with Sublime Text. When I try to start a REPL, I get

SublimeREPL: obtaining sane environment failed in getenv()
Check console and 'getenv_command' setting
WARN: Falling back to SublimeText environment

This happens regardless of which REPL I try to start. (I tried Ruby, Python, and Clojure.) I tried Sublime Text 2 and Sublime Text 3 with the same results. This is on Mac OS X, if that matters.

I looked in the package settings, where I see

"getenv_command": ["/bin/bash", "--login", "-c", "env"],

If I run "/bin/bash --login -c env" at a Terminal prompt, I get my environment listed.

What do I need to change in order to get a successful getenv_command?

解决方案

I had the same problem as ssgam. The problem line for me is in the getenv method. It calls subprocess.check_output(getenv_command), which doesn't exist in python 2.6, which ST2 seems to use.

The trick is, it only calls subprocess.check_output() if getenv_command is truthy, and defaults to os.environ.copy() otherwise. So to get ssgam's fix without modifying the SublimeREPL package, in Preferences > Package Settings > SublimeREPL > Settings - User, do something like this:

{
  "getenv_command": false
}

这篇关于sublimerepl getenv failing的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆