Hello,
I'm getting the following error when trying to schedule a Python script tool

It runs when I do it manually clicking the "run" button. It was also working before when I scheduled it
but now it doesn't. I tried changing the name of the scheduled task many different ways (no underscores, etc). it appears to be something with the output name of the arcpy select tool or the scratchGDB env. I attached a screenshot of the code for review.

Any help greatly appreciated.