0

This is my code:

import win32com.client

outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")

inbox = outlook.GetDefaultFolder(6)
messages = inbox.Items
message = messages.GetLast()
body_content = message.body
print (body_content)

and I am getting the following error:

C:\Users\bre\AppData\Local\Programs\Python\Python36-32\python.exe C:/Users/bre/PycharmProjects/test/TkinterApp/test13.py
Traceback (most recent call last):
  File "C:/Users/bre/PycharmProjects/test/TkinterApp/test13.py", line 1, in <module>
    import win32com.client
  File "C:\Users\bre\AppData\Local\Programs\Python\Python36-32\lib\site-packages\win32com\__init__.py", line 5, in <module>
    import win32api, sys, os
ImportError: DLL load failed: The specified module could not be found.

Process finished with exit code 1

What exactly does this mean, and how would I be able to fix it? I saw that I can download some DLL, but I don't have experience dealing with that. Any suggestions or step-by-step recommendation on how to make this work?

sgerbhctim
  • 3,420
  • 7
  • 38
  • 60

1 Answers1

1

If you look at your Traceback error, you can see where you went wrong. In line 1 of your test13.py file and in in line 5 of the win32 package. The first thing to ask is "what does the error mean?" Take a look here: import win32api error in Python 2.6. Although it is a reference for Python 2, it should give you a good idea of what to do in your similar situation. It seems like you have to move some dll files from where ever they are currently located to the package directory in your Python36-32 directory. For your possible Python 3 needs, here is a good reference: https://github.com/pyinstaller/pyinstaller/issues/1840

Julian Rachman
  • 575
  • 3
  • 15