0

This is my first time to schedule a python script. My goal is to schedule my python script to run every 10 min.

MAIN.PY

from scrapy import cmdline
cmdline.execute("scrapy crawl news".split())

I created a task in windows task scheduler, but my script is not running somehow( I know the script is working since i can run it manually ). I been trying to solve this issue for hours without any luck.

First I select my python path, then I select the filepath for the project and choose the .py I want to run. example here Then I choose to trigger every 10 min.

After doing the steps described above, nothing happens. Hope you can help me with a solution to my problem.

2 Answers 2

2

Not sure that it will fit in your case, but I think it might. Please, check out this topic.

How do you run a Python script as a service in Windows?

Maybe you can run your script as a service and add a simple timer inside the script that launches your routine every 10 minutes from the inside.

Alternative solution that a colleague of mine is using is packing the python script inside an executable by using fbs or pyinstaller and adding it into the task scheduler.

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

2 Comments

I will check alternative solution after, but first I want to figure out how to deal with Windows Task Scheduler and .py I been searching online and most guides show the same and thats why I cant understand why it is not running my script.
I will give your alternative a try. Looking at pyinstaller now.
0

it might be the environment problem.The windows task scheduler is running in C:\Windows\System32 by default,so if your some argument is not absolute path or will changed with the environment,it will get wrong result.i suggest u use some logging way to record your program's running status and result so u can debug where went wrong

1 Comment

Yes, but C:\Windows\System32\Tasks is a Task storage. Each Task will have its individual location added in Actions: New: Program/Script

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.