Reputation: 57
I am using VS Code to execute a python code. I want to automate this windows task scheduler, however i am getting an error.
from VSCode this is what I see on terminal when I run the script;
Loading personal and system profiles took 712ms
(base) PS C:\Users\tableauautomation\Desktop\Python> & 'C:\Users\tableauautomation\Anaconda3\python.exe' 'c:\Users\tableauautomation\.vscode\extensions\ms-python.python-2020.7.96456\pythonFiles\lib\python\debugpy\launcher' '64388' '--' 'c:\Users\tableauautomation\Desktop\Python\ForecastAutomation.py'
job Started: 2020-07-26 18:13:30
i am creating this in Notepad saved as bat but keep getting errors like Numpy or Panda's is not installed.
batchfile has this; call activate my_env "c:\Users\tableauautomation\Desktop\Python\ForecastAutomation.py" pause
Upvotes: 0
Views: 723
Reputation: 76
write the below lines in your notepad with .bat
format.
call activate [my_env]
python c:\Users\tableauautomation\Desktop\Python\ForecastAutomation.py
call conda deactivate
if absolute path of python is not included in $PATH
then use absoulte path of python.exe in .bat
file.
call activate [my_env]
c:\Users\tableauautomation\Anaconda3\python.exe c:\Users\tableauautomation\Desktop\Python\ForecastAutomation.py
call conda deactivate
Upvotes: 1
Reputation: 57
Anyone else have this issue the solution is here; The batchfile needs the following parameter (Windows Machine)
cmd /c C:\Users\tableauautomation\Anaconda3\condabin\conda.bat run "C:\Users\tableauautomation\Anaconda3\python.exe" "c:\Users\tableauautomation\Desktop\Python\ForecastAutomation.py" pause
Upvotes: 0