Added check to make sure input file exists.

Fixed issue where had forgotten to import sys and os modules.