0

I am running the following Python code from jupyter and powershell and it is running flawlessly.

When I put this in window scheduler, it doesn't run. It doesn't show any error either. Could you please help solve the problem? Are there better options to schedule my Python code in window?

I am running python 3.10.

My code was running before:

import win32com.client as win32
outlook = win32.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
mail.To = '[email protected]'
mail.Subject = 'data'
# mail.Body = 'data'
mail.HTMLBody = '''<p style="font-family:Corbel">
    Hi Deepa,<br/>  
    Please find the data for yesterday.<br/>
    Let me know if you has any questions.
</p>
<br/><br/><br/><br/>
                <p  style="font-family:Corbel">
                    <b>Deepankar Srigyan<br/>               
                    BI &amp; Analytics Manager
                </p>
            '''


attachment  = attachment_file
mail.Attachments.Add(attachment)

mail.Send()
3
  • Did you put in the task scheduler as a .bat targeting the file? Did you use any particular setting? Commented Aug 2, 2022 at 13:57
  • The task scheduler logs to the Event Viewer, have you checked that? Commented Aug 2, 2022 at 13:58
  • 1
    Refer to my previous answer to similar issue 👉Use scheduler Commented Aug 2, 2022 at 14:04

1 Answer 1

1

See creating a bat file for python script to understand how to launch your script with a .bat file, then launch that via windows scheduler rather than launching the python script directly.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.