I'd like to use a cron job to run a task which involves a python script.
The bash script for the task looks about like:
#!/bin/bash
...
python ./script.py &
...
Which is called via crontab like:
* 8 * * * ./task.sh
This works perfectly for my needs, except this pesky icon when appears in the dock and steals the current input device focus, interrupting anything I might be typing when the task fires.
Is there a way to tell python to run in the background, similar to having run the python script.py
command via Terminal.app?
Edit: It looks like Matplotlib is the culprit. https://github.com/matplotlib/matplotlib/issues/12918/ Using matplotlib.use("Agg")
to disable the interactive environment while running from CLI prevents the issue.