2015-10-05, 01:29
(2015-10-04, 21:48)Milhouse Wrote:(2015-10-04, 18:02)pgjensen Wrote: I run your program to update thumbnails for movies/tv when my computer wakes up from sleep, so it can cache newly added items. Kodi is always open, so it has initial focus. When I run the python script via the task scheduler, it minimizes Kodi and shows the python console. I've tried running it as "minimized" in the scheduler, tried running a vbs script with different window settings to keep it minimized, etc, but every time it steals focus and minimizes Kodi.
pythonw.exe would launch your script asynchronously with no output, but I believe your script needs a no output option for that to work properly. If you try to write to stdout/stderr/etc I believe it causes pythonw to silently fail.
You can redirect output to NUL on Windows, or to a file. The following works fine on Windows, with no console:
Code:pythonw.exe texturecache.py c movies 1>c:\stdout 2>c:\stderr
If you're not interested in the output, redirect stdout and stderr to NUL:
Code:pythonw.exe texturecache.py c movies 1>NUL 2>NUL
The remaining potential issue is that pythonw executes asynchronously, but that's a general Windows issue with no easy solution if you want to run commands in strict sequence (using third-party/sysinternals tools to polll the process list for the presence of pythonw.exe would be one solution).
PERFECT, thank you!