fixed #1733, the python script perfectly works, tested on both osx and windows

This pull request fixed:
- Handling the difference of line ending between osx and windows
- remove os.popen("rm -rf" + …) usage which can not cross desktop platforms, uses shutil.rmtree() method instead