win32com Python issue

Viewed 17

I am on Windows 7 and am trying to automate some email-related list updates. I have a python script that pulls-in emails, downloads certain attachments and sends me back a new email with some results. This all works great when I run the code manually:

via Windows command prompt.

Within my IDE.

Wrapping it in a .bat file and dbl-clicking the bat file.

To be clear here: When executed in any of the above ways, the script successfully checks emails, parses the attachments and sends an email to myself containing the desired information.

Problem: When I try to set-up a scheduled task (I have admin privileges) on my local PC to run the .bat file, the script terminates at the following lines:

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

Have tried both running as a .bat and also by setting the python path as the program/script and adding the arguments and start in. Worked perfectly for months and all the sudden stopped. Other python scripts without the win32com library run just fine.

0 Answers
Related