Various python3 fixes.

Still need to make more before this runs smoothly in Python 3.

Also, add .pypirc to the .gitignore.