Python Forum
Batch file not running python script in task scheduler
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Batch file not running python script in task scheduler
#1
I have a scrapping python script and a batch file that when run from CMD works perfectly however when I try to run it from Task Scheduler nothing happens.

Don't know if this is relevant but script would open Firefox and scrape some websites.

Have tried adding full permissions to the folders and files that I am using. Also, have tried in Task Scheduler to set up "Run whatever user is logged on or not", "Run with highest privileges" , "Start in (optional): add/bactch/file/path" and so on

Batch file:

py "C:\python_test\myscript.py"


It should run the python script which opens Firefox and scrapes some websites, gets their links and saves them in a csv file

Batch file is in the folder where script is so C:\python_test\batch.bat... if I run this batch file from CMD or by double clicking on it it runs perfectly and executes the script successfully
Reply
#2
Have you tried to log some information to a file from myscript.py when it runs?
Reply
#3
@Gribouillis could you explain a bit better what exactly do you mean?
Thanks
Reply
#4
davork Wrote:@Gribouillis could you explain a bit better what exactly do you mean?
I mean add this in the script's file
import logging
logging.basicConfig(filename='example.log',level=logging.DEBUG)

logging.debug('myscript.py starting.')
...
logging.debug('We reached this point')
...
logging.debug('myscript.py exiting')
Then examine the contents of the file example.log after the script's execution.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Running script from remote to server invisiblemind 4 738 Mar-28-2025, 07:57 AM
Last Post: buran
  Detect if another copy of a script is running from within the script gw1500se 4 1,129 Jan-31-2025, 11:30 PM
Last Post: Skaperen
  Best way to feed python script of a file absolut 6 1,167 Jan-11-2025, 07:03 AM
Last Post: Gribouillis
  No Internet connection when running a Python script basil_555 8 3,271 Mar-11-2024, 11:02 AM
Last Post: snippsat
Question Running Python script through Task Scheduler? Winfried 8 6,606 Mar-10-2024, 07:24 PM
Last Post: Winfried
  Help Running Python Script in Mac OS emojistickers 0 954 Nov-20-2023, 01:58 PM
Last Post: emojistickers
  error "cannot identify image file" part way through running hatflyer 0 2,000 Nov-02-2023, 11:45 PM
Last Post: hatflyer
  Trying to make a board with turtle, nothing happens when running script Quascia 3 1,761 Nov-01-2023, 03:11 PM
Last Post: deanhystad
  Is there a *.bat DOS batch script to *.py Python Script converter? pstein 3 8,151 Jun-29-2023, 11:57 AM
Last Post: gologica
  Python script running under windows over nssm.exe JaroslavZ 0 1,750 May-12-2023, 09:22 AM
Last Post: JaroslavZ

Forum Jump:

User Panel Messages

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