In the command window drawing directly run the python script as usual, handed the background task "could not open display" run-time error
Access to information that it may be related to the display window, you need to add two lines of code
import matplotlib as mpl
mpl.use('Agg')
Script has been tested and stable operation of a certain time, no other problems.