ledger/ledger — pull request #181 by jvrsantacruz (2013-04-27 12:05:39+00:00)
Title: Improves acprep python3 compatibility

The acprep script uses the following shebang line `#!/usr/bin/env python` which in my system happens to be `python 3.3`, making it impossible to simply run `./acprep update` as stated in the documentation, for the script is Python 2 only.

I would recommend to either:

1. Change shebang line to `#!/usr/bin/env python2`
2. Remove Python2-only code from the script.

This commit implements the 2. option by replacing all the Python2 specific code.

No extensive testing with full-branch execution has been performed, though, so this still might result in hidden incompatibilities yet to be discovered by further executions of the script under Python3.

Replaces string.join with str.join
Forces conversion to str from byte-returning functions
Introduces usage of 'as' keyword when catching exception instances
Replaces has_key with usage of the 'in' keyword for dictionary key presence checking.