IOError: [Errno 13] Permission denied: 'D:/VMware/VMware Workstation/vmwarebase.dll' 的解决

今天准备在windows 10 上 安装MAC的虚拟机,再执行unlocker.exe时,总是遇到如下错误:

 在网上找到了两个解决方法,一个是说python的版本问题,一个说是python的路径分隔符问题,结果两个解决方法都不行。

于是找到了一个关于文件读取的说明:

``r'' Open text file for reading. The stream is positioned at the beginning of the file.

``r+'' Open for reading and writing. The stream is positioned at the beginning of the file.

``w'' Truncate file to zero length or create text file for writing. The stream is positioned at the beginning of the file.

``w+'' Open for reading and writing. The file is created if it does not exist, otherwise it is truncated. The stream is positioned at the beginning of the file.

``a'' Open for writing. The file is created if it does not exist. The stream is positioned at the end of the file. Subsequent writes to the file will always end up at the then current end of file, irrespective of any intervening fseek(3) or similar.

``a+'' Open for reading and writing. The file is created if it does not exist. The stream is positioned at the end of the file. Subse- quent writes to the file will always end up at the then current end of file, irrespective of any intervening fseek(3) or similar.

From python documentation - http://docs.python.org/2/tutorial/inputoutput.html#reading-and-writing-files:-

On Windows, 'b' appended to the mode opens the file in binary mode, so there are also modes like 'rb', 'wb', and 'r+b'. Python on Windows makes a distinction between text and binary files; the end-of-line characters in text files are automatically altered slightly when data is read or written. This behind-the-scenes modification to file data is fine for ASCII text files, but it’ll corrupt binary data like that in JPEG or EXE files. Be very careful to use binary mode when reading and writing such files. On Unix, it doesn’t hurt to append a 'b' to the mode, so you can use it platform-independently for all binary files.

找到unlocker.py的脚本中读取文件的代码:

发现这里使用的是r+b,把r+b改为r,再执行python unlocker.py,就可以了。

 

 

由于作者本人的github上删除了unlocker的所有内容,最后,从https://github.com/BDisp/unlocker 找到了最新的版本,没有发现脚本有类似问题。直接执行批处理文件,就可以了。

 

 

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章