尽管文件标识符已关闭,但无法删除文件[WinError 32]

时间:2018-08-07 14:18:11

标签: python python-3.x permissions file-permissions

我有几个文本文件,阅读它们的内容后不需要。为此,我使用:

inistialShapes

这会导致 PermissionError:[WinError 32] ,告诉我该文件仍在另一个进程中使用。 仔细阅读后,我认为var updatedShapes = this.state.initialShapes.map (sh => { var data = {}; data.name = sh.name; data.x1 = sh.x; data.y1 = sh.y; data.x2 = sh.x + sh.width; data.y2 = sh.y + sh.height; return data; }); this.setState ({finalShapes : updatedShapes }); 已经关闭了文件标识符,我最初认为是问题所在。但是无论最后是否添加with open('MyData.txt') as f: ... f.close() # same problem, with or without close() os.remove('MyData.txt') ,我都会收到此错误。


免责声明:如果这很重要,则不要知道: 我正在使用 matlab_engine 模块,在其中导入文本文件并提取更多信息。我在尝试删除文件之前先停止了matlab引擎。

信息: 在Windows 10上使用Python 3.6

0 个答案:

没有答案