How to run Python script in task scheduler?

Hi everybody!

I have a simple script that parse the. XLSX file and generates some CSV using the library openepyxl. I made it into a. EXE file using the pyinstaller to run on a machine where no Python, using the task scheduler.

Problem: if you run the. exe file or script by hand, everything works fine. If you run the same script or exe using Windows scheduler, the task is not running, and the result 0xFF. The job runs under a service user rights to run there. If you set the scheduler to set the option "Run only when user is logged in", then it works, if you set the option to launch out whichever user is logged in or not, nothing works.

Has anyone encountered similar? Apparently, the library requires interactivity from the session.
April 19th 20 at 12:20
1 answer
April 19th 20 at 12:22
Solution
the path to the Python file is absolute
inside the script all the way - absolute
Within the script use the read from two configuration files, which are in the script folder. For absolute paths, specify only the name.

To eliminate this problem, tried to make a batch file where the first line was the team CD АбсолютныйПутьКДиректорииГдеЛежитскрипт to run script from it.

Try to specify the absolute path to these files. - Freddy_Ratke commented on April 19th 20 at 12:25
you can train using absolute dir path to the current directory, enter - Laurie_Koss26 commented on April 19th 20 at 12:28

Find more questions by tags The task schedulersWindowsPython