0

This seems to be a recurrent question in many forums but after applying most of the solutions found, it's still not working.

The end of my python scripts creates two CSV files using the following code:

file1.to_csv(csvfilename, sep=",", encoding='utf-8', index=False)
file2.to_csv(csvfilename2, sep=",", encoding='utf-8', index=False)

I created a bat file within the same folder of my python script with the following code in:

@echo off
"C:\Program Files\Python35\python.exe" "Pythonscript1.py"

And in the task scheduler i created a task. I added an action and modified the Program/script with the path of my bat file:

"C:\Users\name\PycharmProjects\Templates\executePy.bat"

After run the task, no csv files have been created.

6
  • 3
    Have you tried adding the absolute path of your python script in your bat file? Commented Dec 28, 2018 at 20:27
  • how should i do this, add it before the file name within the quotation marks? Commented Dec 28, 2018 at 20:51
  • That should work fine. Commented Dec 28, 2018 at 20:54
  • As @busybear said, use the absolute path to your script. Also you may want to try setting the "Start in" parameter for the action in task scheduler. Commented Dec 28, 2018 at 21:18
  • why is the task status showing as running after 30 mns? it appears it works Commented Dec 28, 2018 at 21:41

1 Answer 1

1

Your task scheduler is not working in the directory your Python script is in. It's best to point to the script using its absolute path to avoid ambiguity.

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.