I have a simple python script that when I run it via command line it'll run. I also created a batch file to run the python script as well. When I double click that it'll run just fine. I can't get either the python script or the batch file containing the python script to run in Windows Task Scheduler and get and error see below. I just want to be able to run the Python script or batch file via task scheduler. I've tried multiple things from other qustions on here about putting the full path in the arguments and start in locations, and still get the same results.
This is my batch file code that works when double clicking the file just fine but won't run in task scheduler: "C:\Users\brant.evans\AppData\Local\Programs\Python\Python39\python.exe" "C:\Users\brant.evans\SQ Back Office-COR - General\PCMS_Part_Comments\Current_CSV_Output\PCMS_Parts_CSV_to_Excel.py" pause
Here is the error I get when running it via task scheduler:
Traceback (most recent call last):
File "C:\Users\brant.evans\SQ Back Office-COR - General\PCMS_Part_Comments\Current_CSV_Output\PCMS_Parts_CSV_to_Excel.py", line 7, in <module>
df_new = pd.read_csv('Current_PCMS_Parts.csv')
File "C:\Users\brant.evans\AppData\Local\Programs\Python\Python39\lib\site-packages\pandas\io\parsers.py", line 605, in read_csv
return _read(filepath_or_buffer, kwds)
File "C:\Users\brant.evans\AppData\Local\Programs\Python\Python39\lib\site-packages\pandas\io\parsers.py", line 457, in _read
parser = TextFileReader(filepath_or_buffer, **kwds)
File "C:\Users\brant.evans\AppData\Local\Programs\Python\Python39\lib\site-packages\pandas\io\parsers.py", line 814, in __init__
self._engine = self._make_engine(self.engine)
File "C:\Users\brant.evans\AppData\Local\Programs\Python\Python39\lib\site-packages\pandas\io\parsers.py", line 1045, in _make_engine
return mapping[engine](self.f, **self.options) # type: ignore[call-arg]
File "C:\Users\brant.evans\AppData\Local\Programs\Python\Python39\lib\site-packages\pandas\io\parsers.py", line 1862, in __init__
self._open_handles(src, kwds)
File "C:\Users\brant.evans\AppData\Local\Programs\Python\Python39\lib\site-packages\pandas\io\parsers.py", line 1357, in _open_handles
self.handles = get_handle(
File "C:\Users\brant.evans\AppData\Local\Programs\Python\Python39\lib\site-packages\pandas\io\common.py", line 639, in get_handle
handle = open(
FileNotFoundError: [Errno 2] No such file or directory: 'Current_PCMS_Parts.csv'
I just want to be able to either use the python script directly or the batch file that has the python script in it via Windows Task Scheduler so I can schedule it to run. I know that both work if I manually run them in the command prompt or just double clicking the batch file.