Fix the preference file generation for Python 3 (hopefully...)