How to close the file after reading?
corobin opened this issue · comments
Hello,
I hope this is an acceptable place to ask a quick question, I tried looking everywhere but couldn't find documentation :(
Explanation:
The readme has an example for opening a .msg file, as such:
msg = extract_msg.openMsg("path/to/msg/file.msg")
I can read the .msg data just fine, but when i go to rename the file based on the metadata I get this error:
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\test\\lorem.msg' -> 'C:\\test\\ipsum.msg'
Using powertoy's what's using this file utility i see that python is what's holding it open, which leads me to believe that msg-extractor is the one that is not closing the file.
Question: How do you close the file?
Thanks!
The wiki details opening and closing the files, under the section of using it in your own code. It is closed just as a normal file would be, with the close
method.
msg.close()
oh I didn't know about the wiki doh
thank you very much!