回答此问题可获得 20 贡献值,回答如果被采纳可获得 50 分。
<p>我有pst文件,我想用python打开它,我该怎么办</p>
<p>我试着去图书馆,但没用</p>
<p>我的代码是:</p>
<pre><code>import mailparser
mail = mailparser.parse_from_bytes(byte_mail)
mail = mailparser.parse_from_file('c/document/1.pst')
print(mail.attachments) #list of all attachments
</code></pre>
<p>但是得到这个错误:<code>mailparser.exceptions.MailParserOSError: To use this function you must install 'msgconvert' tool</code></p>
<pre><code>----------All error text:-----------------
To use this function you must install 'msgconvert' tool
Traceback (most recent call last):
File "C:\Users\aa\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mailparser\utils.py", line 229, in msgconvert
stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
File "C:\Users\aa\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 775, in __init__
restore_signals, start_new_session)
File "C:\Users\aa\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 1178, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
Traceback (most recent call last):
File "C:\Users\aa\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mailparser\utils.py", line 229, in msgconvert
stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
File "C:\Users\aa\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 775, in __init__
restore_signals, start_new_session)
File "C:\Users\aa\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 1178, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:/Drive D/my projects/azar/untitled java 13 12 2019/Pst mail.py", line 3, in <module>
mail=mailparser.parse_from_file_msg('C:/Users/aa/Documents/1.pst')
File "C:\Users\aa\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mailparser\mailparser.py", line 89, in parse_from_file_msg
return MailParser.from_file_msg(fp)
File "C:\Users\aa\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mailparser\mailparser.py", line 203, in from_file_msg
f, _ = msgconvert(fp)
File "C:\Users\aa\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mailparser\utils.py", line 234, in msgconvert
raise MailParserOSError(message)
mailparser.exceptions.MailParserOSError: To use this function you must install 'msgconvert' tool
-----------------------------------
</code></pre>