【发布时间】:2013-11-14 02:35:12
【问题描述】:
LSOpenURLsWithRole() failed with error -600 for the URL http://localhost:9000/.
这是我在 tmux 会话中尝试启动 SimpleHTTPServer 时遇到的错误。我是一名前端 Web 开发人员,我大部分时间都在使用SimpleHTTPServer,而不是Apache。问题是它在open 命令中出错,因为我有直接从终端打开文件和目录的习惯(open dirname/ 或open .),当我在tmux 中使用它时,它给出了我同样的错误。
我想提一下,我使用的是 Macbook Air,运行 OSX 10.9 Mavericks。
这是我在终端中用来启动服务器的函数代码:
# Start an HTTP server from a directory, optionally specifying the port
function server() {
local port="${1:-8000}"
open "http://localhost:${port}/"
# Set the default Content-Type to `text/plain` instead of `application/octet-stream`
# And serve everything as UTF-8 (although not technically correct, this doesn’t break anything for binary files)
python -c $'import SimpleHTTPServer;\nmap = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map;\nmap[""] = "text/plain";\nfor key, value in map.items():\n\tmap[key] = value + ";charset=UTF-8";\nSimpleHTTPServer.test();' "$port"
}
编辑
该问题不再出现,因此我有 3 种可能的解决方案:
极不可能:
- 从 Python3 更改为 Python 2.7.5(OS X 默认)
最有可能:
- Apple 发布了修复此问题的 Mavericks 更新
- 安装命令行工具以使用 Homebrew 构建和安装最新版本的 VIM
【问题讨论】:
-
您的
tmux会话是从 ssh 连接启动的,还是至少不是从 Mac UI 启动的?这会导致open无法连接到可能触发错误的窗口服务器。 -
@robertklep 不,不是。这是我在我的机器上启动的本地会话。那天晚上,我尝试在重新启动等之后以不同的方式启动多个会话,但似乎没有任何效果。
-
我在 Yosemite 和带有 tmux 的 nodeJs 上看到了这个
标签: python macos terminal tmux simplehttpserver