Knowledgebase

Writing a Reliable Script Print

  • python, errors, guide, howto, solution, zillionkinghost, hosting, support
  • 0

Beyond working once.

WHAT A RELIABLE SCRIPT DOES

States what it is doing Handles failure explicitly Leaves things consistent if interrupted Can be run again safely Logs enough to diagnose

THAT FOURTH POINT

Running twice should not do the work twice, or should be harmless if it does.

WHY THAT MATTERS

Scripts get run again after an apparent failure.

WHAT TO BUILD IN

A check of preconditions before starting Clear failure, rather than partial completion A summary at the end

WHAT TO AVOID

Assuming files exist Assuming a network call succeeds Assuming data is well formed Continuing after an error

WHAT TO DO ABOUT PARTIAL FAILURE

Decide deliberately: stop entirely, or record and continue.

Then say which in the output.

WHAT TO TEST

The failure paths, not only the success path.

HOW

Give it bad input deliberately.

WHAT TO ADD BEFORE RELYING ON IT

Logging, and a way to know it ran.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot