Automation That Requires a Manual Is Not Automation
If your script breaks because a file name has a space in it, you haven't built automation. You've built a trap. Industrial automation must be robust.
The Script That Cried Wolf
The IT team delivered a new automation tool. It was supposed to upload inspection photos to the server automatically. “It saves ten hours a week!” they said.
On Monday, the Site Admin called me. “It’s broken.”
I checked the logs. The script had crashed.
Why? Because one photo was named Site Photo (1).jpg.
The script did not like the parentheses (). It choked.
The IT team said: “Tell the users not to use parentheses.” I said: “No. Tell the script to handle parentheses.”
If the user needs a manual to keep the robot happy, the robot is not working for us. We are working for the robot.
The Fragile Link: Happy Path Programming
Developers often build for the “Happy Path.”
- The file is always there.
- The name is always correct.
- The internet is always on.
This is a fantasy. In operations, the path is never happy. The path is muddy. Users will drag the wrong file. They will double-click when they should single-click. They will upload a PDF instead of a JPG.
If your automation crashes on a simple error, it creates fear. The user thinks, “I broke it.” They stop using it. They go back to the manual way. The manual way is slow, but it doesn’t crash.
The Sturdy Fix: Sanitation and Resilience
We rewrote the script. We made it load-bearing.
1. Assume the Input is Dirty.
The script now takes the file name and strips out the bad characters.
Site Photo (1).jpg becomes Site_Photo_1.jpg automatically. It does not ask permission. It just cleans it.
2. Check Before You Leap. Does the folder exist? If no, create it. Is the file empty? If yes, skip it and log a warning. Do not crash. Adapt.
3. Loud Success, Quiet Failure. If one file fails, do not stop the whole batch. Skip the bad one. Upload the rest. Then give me a report: “99 uploaded. 1 failed.”
[TO EDITOR: Diagram showing a ‘Filter’ funnel. Dirty inputs go in top -> Filter cleans/rejects -> Clean process runs at bottom.]
Build for a Bad Day
Do not build tools for the best day of the year. Build them for a rainy Tuesday when the user is tired and the internet is slow. Automation is infrastructure. A bridge does not collapse just because a heavy truck drives over it. It is built with a margin of error. Give your code a margin of error. Make it sturdy.
FAQs
But we can't account for every user error.
You can account for the top three. Wrong name, wrong format, empty file. Handle those, and you solve 90% of the crashes.
It works on my machine though.
'My machine' is a laboratory. The site is the real world. If it doesn't work on the Site Manager's old laptop, it doesn't work.
What is 'Sanitization'?
It is washing the muddy boots before entering the house. The code should clean the data before trying to process it.