Catch illegal port file content, including an empty file.

and print a sensible error message instead of a traceback.