Scheduling A Python Script Via Windows Task Scheduler
Observe the following Python script, 'Script.py': import subprocess src_directory = 'Z:\z_7z\Some_Directory' zip_file_name = 'Test.7z' cmd = ['7z', 'a', zip_file_name, src_director
Solution 1:
Don't just launch
7z
. Provide the full path to the executable.cmd = [r'C:\Program Files\7zip\7z.exe', 'a', zip_file_name, src_directory, '-mx9'] Would work, considering that
C:\Program Files\7zip\7z.exe
is the executable path.Try not running the
python
process with the script as an argument. Run the python script itself.Your
zip_file_name
is relative. I'm not sure the argument is a filename. It may be a path. In that case, the .7z file may be created onC:\Windows\System32
. To fix it, setzip_file_name
to be a full path.
Post a Comment for "Scheduling A Python Script Via Windows Task Scheduler"