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
  No Internet connection when running a Python script basil_555 8 442 Mar-11-2024, 11:02 AM
Last Post: snippsat
Question Running Python script through Task Scheduler? Winfried 8 335 Mar-10-2024, 07:24 PM
Last Post: Winfried
  Help Running Python Script in Mac OS emojistickers 0 306 Nov-20-2023, 01:58 PM
Last Post: emojistickers
  error "cannot identify image file" part way through running hatflyer 0 613 Nov-02-2023, 11:45 PM
Last Post: hatflyer
  Trying to make a board with turtle, nothing happens when running script Quascia 3 608 Nov-01-2023, 03:11 PM
Last Post: deanhystad
  Is there a *.bat DOS batch script to *.py Python Script converter? pstein 3 3,008 Jun-29-2023, 11:57 AM
Last Post: gologica
  Python script running under windows over nssm.exe JaroslavZ 0 671 May-12-2023, 09:22 AM
Last Post: JaroslavZ
  Python Script to convert Json to CSV file chvsnarayana 8 2,344 Apr-26-2023, 10:31 PM
Last Post: DeaD_EyE
  Running script with subprocess in another directory paul18fr 1 3,480 Jan-20-2023, 02:33 PM
Last Post: paul18fr
  Web project and running a .py file emont 0 619 Dec-11-2022, 11:15 PM
Last Post: emont

Forum Jump:

User Panel Messages

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