phpserialize on Python 3

I was playing around with phpserialize and found out that phpserialize doesn’t work on Python 3.

However, I put together a GitHub fork that works with Python 3 (and also has tests, especially for Unicode which is the real gotcha when porting from Python 2.x to Python 3.x):

To use this, I put

-e git+git://

in my pip requirements file.

For Tox (a recent find and a very nice tool), this needs to be tweaked because it uses ConfigParser to parse its ini file and ConfigParser swallows the stuff after the # as a comment (I could find no way to escape the #; others have noticed this too). So in my tox.ini I used:

for the deps setting.

Full tox.ini for the curious:

Easy access to TrueCrypt from the command-line in OS X

TrueCrypt on Mac OS X has a nice GUI, but if you’re a command-line afficionado…

Put this in your ~/.bashrc or similar file:

alias truecrypt='/Applications/ --text'

Then you can do stuff like:

$ truecrypt
Usage: Truecrypt [--auto-mount <str>] [--backup-headers] [--background-task] [-C] [-c] [--create-keyfile] [--delete-token-keyfiles] [-d] [--display-password] 
[--encryption <str>] [--explore] [--export-token-keyfile] [--filesystem <] [-f] [--hash <str>] [-h] [--import-token-keyfiles] 
[-k <str>] [-l] [--list-token-keyfiles] [--load-preferences] [--mount] [-m <str>] [--new-keyfiles <str>] 
[--new-password <str>] [--non-interactive] [-p <str>] [--protect-hidden <str>] [--protection-keyfiles <str>] 
[--protection-password <str>] [--random-source <str>] [--restore-headers] [--save-preferences] [--quick] [--size <str>] 
[--slot <str>] [--test] [-t] [--token-lib <str>] [-v] [--version] [--volume-properties] [--volume-type <str>] [Volume path] [Mount point]


$ truecrypt --text --non-interactive --password=(password) --mount /Users/marc/Dropbox/TrueCryptVolume.truecrypt /Volumes/TrueCrypt

12:31:43 $ ls /Volumes/TrueCrypt
Audio/     Backups/   Documents/ Taxes/


$ truecrypt --list
1: /Users/marc/Dropbox/TrueCryptVolume.truecrypt /dev/disk4 /Volumes/TrueCrypt


$ truecrypt --dismount
$ truecrypt --list
Error: No volumes mounted.

My failed attempt at using autofs to automount TrueCrypt volumes on OS X

I was trying to make it as easy as possible to access our YNAB file which lives in an encrypted TrueCrypt volume. The idea was to have OS X autofs automount the TrueCrypt volume so that when YNAB starts and attempts to load our document, TrueCrypt launches and asks for the password and then the volume mounts. I never got it working smoothly. I also tried sticking the password in the script, which is less than ideal, but that didn’t work either.

The following almost works, but not quite. If you can get it working, please let me know.

First, /etc/auto_master:

09:30:48 $ cat /etc/auto_master
# Automounter master map
+auto_master		# Use directory service
/net			-hosts		-nobrowse,hidefromfinder,nosuid
/home			auto_home	-nobrowse,hidefromfinder
/Network/Servers	-fstab
/-			-static
/auto			auto_truecrypt

Then /etc/auto_truecrypt (which is executable):

09:30:53 $ cat /etc/auto_truecrypt 



if [ "$1" == "Truecrypt" ]; then
    echo "-fstype=truecrypt    :${TRUECRYPT_VOLUME}"

And /sbin/mount_truecrypt:

09:30:58 $ cat /sbin/mount_truecrypt 

echo "$0: Called with $@" >> /dev/ttys000
# echo open -W /Applications/ --args "$7" "$8" >> /dev/ttys000
# open -W /Applications/ --args "$7" "$8"
echo /Applications/ --text --non-interactive --password=(password) "$7" "$8" >> /dev/ttys000
/Applications/ --text --non-interactive --password=(password) "$7" "$8"

As is, when I have the script calling /Applications/ with a password, I get:

$ cd /auto/Truecrypt
(Mac locks up with spinning beach ball)

The script actually locks up my MacBook Pro with OS X 10.6.8. The script is probably called in a kernel context or with some big lock and trying to launch a complex userland process from there creates some kind of deadlock. Well, that’s my guess anyway. So be careful — don’t try this if you’re not ready to reboot.

More pull requests accepted into South

I had a few more of my contributions accepted into South:

Bitbucket pull request #10: Make `schemamigration` output more readable and PEP8-compliant
Bitbucket pull request #11: Print the failing SQL when a query fails
Bitbucket pull request #12: For migrate –list –verbosity=2, print the datetime that migrations were applied
Bitbucket pull request #13: Add ability to migrate forwards and backwards easily one by one