The main problem is related with the way the .fwm file is opened.
With Python 3 the file has to be opened as bytes. However this enforces other changes in the code.
The following docs might help:
http://python3porting.com/problems.html#bytes-strings-and-unicode