Python 3 and unicode

Fix problem where the unicode function does not exist in python 3.

Also, fixed a problem with running tests on mac os x (see [Stack Overflow](http://stackoverflow.com/questions/12482702/pythons-os-chdir-and-os-getcwd-mismatch-when-using-tempfile-mkdtemp-on-ma)).