Python 并非win32com.client从outlook 2016读取的所有邮件

Python 并非win32com.client从outlook 2016读取的所有邮件,python,outlook,Python,Outlook,我在使用库win32com.client读取Outlook 2016中的邮件时遇到了一些奇怪的问题。我使用下面的代码 具体地说,这段代码编写标题文件夹和子文件夹。然后我通过pyinstaller生成.exe。代码正在工作,但在其他计算机上可能不工作。具体来说,不显示子文件夹,也不显示所有文件夹 from win32com.client import Dispatch outlook = Dispatch("Outlook.Application").GetNamespace("MAPI") r

我在使用库win32com.client读取Outlook 2016中的邮件时遇到了一些奇怪的问题。我使用下面的代码

具体地说,这段代码编写标题文件夹和子文件夹。然后我通过pyinstaller生成.exe。代码正在工作,但在其他计算机上可能不工作。具体来说,不显示子文件夹,也不显示所有文件夹

from win32com.client import Dispatch

outlook = Dispatch("Outlook.Application").GetNamespace("MAPI")
root_folder = outlook.Folders.Item(1)

for folder in root_folder.Folders:
    print(folder.Name)
    for fol in folder.Folders:
        print('-' + fol.Name)
最后,我想从需要子文件夹加载附件,但这个问题困扰着我继续前进