Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python script involving Outlook through win32com runs when double-clicking, but not through task scheduler

I have a python script that sends out an email using win32com and Outlook. The script runs without a hitch when I run it through an interpreter or double-click on the script. However, when I run it through the Task Scheduler, I get the following message:

"Something went wrong. We couldn't start your program. Please try starting it again. If it won't start, try repairing Office from 'Programs and Features' in the Control Panel."

I'm using Office 365, and Python 2.6. I've tried running the script through the scheduler after killing the Outlook process, but I ran into the same issue.

like image 570
chungsangh Avatar asked Feb 03 '14 18:02

chungsangh


1 Answers

Office isn't designed to run as a service, and needs to be run interactively. You'll need to change your task configuration in Task Scheduler to run the task as the currently logged-in user, on the current user's desktop, with the current user's privileges.

like image 92
Eric Brown Avatar answered Oct 18 '22 15:10

Eric Brown