Added python3 support and fixed Windows compatiblity.

I tested this on Windows 7 ultiamte 32bit and Ubuntu LTS14.04 64bit.