python3 compatibility, better command line options

This commit adds support for python3, and also makes the config file location configurable
I was too hasty: in python3, OSError is exactly the same as socket.error. This is redundant.