I think you need to import sys.