Python Forum
pywin32: Outlook connection ends with 'operation aborted' on one machine
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pywin32: Outlook connection ends with 'operation aborted' on one machine
#1
Hello Python Community!

I'm trying to create an MD5 hash of email contents in order to be able to identify it by its contents afterwards.
Also, the code is intended to be used across multiple machines. I'm running Python 3.10.4 on two computers with pywin32 304:

Output:
C:\Users\thisisme1>pip show pywin32 Name: pywin32 Version: 304 Summary: Python for Window Extensions Home-page: https://github.com/mhammond/pywin32 Author: Mark Hammond (et al) Author-email: [email protected] License: PSF Location: c:\users\thisisme1\appdata\local\programs\python\python310\lib\site-packages Requires: Required-by: jupyter-core, xlwings
When running the following code:

import win32com.client

outlook = win32com.client.Dispatch('Outlook.Application').GetNamespace("MAPI")
messages = outlook.Folders['[email protected]'].Folders["Inbox"].Folders["Folder1"].Folders["Folder2"].Items
messages_list = list(messages)

print(messages_list[0].HTMLBody)
On machine 1 (Windows 11), the html body of the first email will be printed. When running the same code on machine 2 (Windows 10), execution will terminate with an error:

Error:
PS C:\Users\thisisme2> & C:/Users/thisisme2/AppData/Local/Programs/Python/Python310/python.exe "c:/Users/thisisme2/.../test.py" Traceback (most recent call last): File "c:\Users\thisisme2\...\test.py", line 7, in <module> print(messages_list[0].HTMLBody) File "C:\Users\thisisme2\AppData\Local\Programs\Python\Python310\lib\site-packages\win32com\client\__init__.py", line 583, in __getattr__ return self._ApplyTypes_(*args) File "C:\Users\thisisme2\AppData\Local\Programs\Python\Python310\lib\site-packages\win32com\client\__init__.py", line 572, in _ApplyTypes_ self._oleobj_.InvokeTypes(dispid, 0, wFlags, retType, argTypes, *args), pywintypes.com_error: (-2147467260, 'Operation aborted', None, None)
"[email protected]" is one of two (machine 2) or several (machine 1) accounts configured. However, running
print(messages_list[0].ReceivedTime)
will work on both machines:

machine 1:
Output:
PS C:\Users\thisisme1> & "C:/Users/thisisme1/AppData/Local/Programs/Python/Python310/python.exe" "c:/Users/thisisme1/.../test.py" 2022-01-28 12:02:00+00:00
machine 2:
Output:
PS C:\Users\thisisme2> & C:/Users/thisisme2/AppData/Local/Programs/Python/Python310/python.exe "c:/Users/thisisme2/.../test.py" 2022-04-22 10:12:03.906000+00:00
I'm out of ideas and appreciate your thoughts on this issue. Thanks a lot!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Search Outlook Inbox for set of values cubangt 1 1,110 Jun-28-2023, 09:29 PM
Last Post: cubangt
  Save image from outlook email cubangt 1 712 Jun-07-2023, 06:52 PM
Last Post: cubangt
  How to find PyWin32 for Python 2.1.3 Paul_Newton 9 1,713 Nov-20-2022, 09:15 PM
Last Post: Paul_Newton
  pywin32 problems catlessness 0 1,239 Apr-01-2022, 01:04 PM
Last Post: catlessness
  Mark outlook emails as read using Python! shane88 2 6,580 Feb-24-2022, 11:19 PM
Last Post: Pedroski55
  Trying out the parsing/reading of emails from my outlook cubangt 0 6,188 Jan-12-2022, 08:59 PM
Last Post: cubangt
  Serial connection connection issue Joni_Engr 15 8,106 Aug-30-2021, 04:46 PM
Last Post: deanhystad
  pywin32 Illustrator Throwing Exception Error matthewsjc1 7 5,612 Aug-27-2021, 02:43 AM
Last Post: Larz60+
  Regex: a string does not starts and ends with the same character Melcu54 5 2,445 Jul-04-2021, 07:51 PM
Last Post: Melcu54
  threadlocals are garbage collected before thread ends akv1597 0 1,814 Mar-09-2021, 12:13 PM
Last Post: akv1597

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020