It looks like you have cut off part of your code at the bottom, post code, not pictures of code. Please see Wiki - how to post code on this forum.
Other points of note:
-This doesn't appear to be a project library script, as I'm not seeing any function def anywhere.
-Don't use exit(), full stop. If you need to exit your logic early, put your logic in a function in the project library and use return. Call said function from your button.
-Ignition provides built in methods for both reading and writing to files. Use system.file.writeFile instead of ImageIO.write.
-In general, use built in Ignition methods before deferring to java or python packages (especially with times/dates).