Missing an 'import sys'. Thanks Padraic Harley for pointing this out