Catch illegal port file content, including an empty file.

and print a sensible error message instead of a traceback.
Merge pull request #378 from hjoliver/catch-illegal-port-file-content

Catch illegal port file content, including an empty file.