limit the times to try mkdir and check the OSError error number
in python the exception catch grammar should be "OSError as e"