I have encountered an issue that I have never encountered before when using bat files. I have several scripts that I run using bat files and windows task scheduler without issues. For some reason, this particular script that I wrote runs perfectly fine from the bat file or as is, but it returns a particular error and it is something that is causing a lot of headache for me to troubleshoot. I would greatly appreciate any suggestions that would help remedy this issue?
I'd suggest writing the output of the batch file to some sort of logfile (If you aren't doing this already). That way you know exactly what you need to debug.
Most batch files I configure to run a python script look something like:
python script.py > run.log
When the script finishes running, you can view the printouts on the run.log file.