'How to catch any exceptions during batch file execution of a python script?
I have a batch file scheduled to run a python script every morning. The script is supposed to append to a .csv file. However, some days no data is appended to the csv file which I believe is due to an error during execution of the script. Is there anything I can add to my batch file to save any error messages that cause the script to stop execution to a .txt file? Or is there a better way to do this within the python script instead? Right now in my batch file I just have
python "C:\filepath\pythonscript.py"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
