Archive for the ‘Code’ Category

ssh-askpass on Mac OS X

January 16th, 2009
Tags: , , , | Posted in Application, Code | 4 Comments »

Got a lot of errors like:

ssh_askpass: exec(/usr/local/libexec/ssh-askpass): No such file or directory

while I was using subversion in BBEdit trying to update my working copy.

Well, actually I don’t have ssh-askpass in that path, and I don’t know here I can get it. But lately I found I successfully update my working copy using Versions or Cornerstone. BTW they are all good applications with great UI. So I digged into Cornerstone’s content folder and found that it has a helper application inside called “SSHAskPass”. How wonderful~! Immedially I created a symbolic link using ln -s /Applications/Cornerstone.app/Contents/Helpers/SSHAskPass.app/Contents/MacOS/ssh-askpass ssh-askpass in /usr/libexec.

Works perfect in BBEdit now.

4 Comments »

在 Python 中读取 utf-8 文件

June 2nd, 2008
Tags: | Posted in Code | 4 Comments »

在 Python 中读取 utf-8 文件可以用 codecs 来实现:

import codecs
file = codecs.open( "filename", "r", "utf-8" )
text = file.read()

最近在群里放了一个没头没脑小机器人来玩,说话的时候需要读一些 utf-8 格式的纯文本文件,用到了上边的代码。

jabberbot.png

4 Comments »

||