Byobu (Advanced GNU Screen) under Centos 5/Python 2.4

I recently discovered Byobu, which is a set of scripts that lets you use GNU Screen more easily. If you spend a lot of time ssh’d into a server, you should definitely check it out. It worked fine on my desktop machine, but on my Centos 5 server, not so much. I did a little research and I found there were two problems.

The easy problem was keeping F2-F4 from working. The trick is that /etc/screenrc has the following line in it:

termcapinfo xterm 'k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~'

Commenting out the line make the function keys work! That was easy.

The 2nd problem was that F9 was not bringing up the menu. Well, most of the time. Sometimes you could get a peek of a Python traceback and sometimes — not often — it would work. The real puzzle was that if you started byobu-config from the command line it worked fine.

It turns out Centos has Python 2.4 which is pretty old. I intercepted stderr from the script and found out that a command that was reading from a pipe was returning “System Call Interrupted.” This isn’t really an error, but this version of Python apparently thinks it is. So sometimes, that signal wouldn’t interrupt the pipe and it would work.

I tried installing Python 2.6 but there are a lot of dependencies in Centos on Python and although I found someone with a “parallel” RPM it didn’t have the necessary libraries and I finally gave up. But then it hit me. If I could just pause a bit before the offending pipe, the signal would come in — not interrupt the pipe — and then all would be well. It seems to work!

Here’s the fix:

if os.path.exists("%s/.%s/disable-autolaunch" % (HOME, PKG)):
return 0
time.sleep(3)

The script already imports time, so that wasn’t a problem. Problem solved. I like Byobu!

Trampy Emacs

I’ll confess that although I can use vi, I prefer emacs. If I’m using Linux or the excellent under Windows, it is my text editor (well, actually my environment) of choice.

There’s a great plug in that allows you to edit files on remote machines using emacs, called — amusingly enough — tramp. The home page is at and if you use Cygwin, you might check out: .

The system relies on ssh (well, technically scp). If you want to edit a remote file you just open up a “file name” like /[theal@www.myremotemachine.com]/home/theal/public_html/index.html and tramp copies it down, allows you to edit the file and then pushes it back to the server when you save it.

Really cool!

Free OCR Tool

When HP exited the optical character recognition business in 1995, its Tesseract OCR engine was released to UNLV as open source. In January, developers (including some from Google) decided Tesseract was stable enough to “re-release” as an open source project.

Don’t expect too much. You’ll need to compile the source code (if you use Cygwin, be prepared to copy /usr/include/limits.h to /usr/include/linux/limits.h or fix the source). And then you get a command line tool that reads single-column TIFF files from the command line. But the accuracy is much better than most of the cheap OCR tools out there.

Try it here.