Using moth balls to keep snakes away is a common myth, as they have very little effect on snakes. The best method to keep snakes away is through prevention.
Instead of spraying repellents that only put chemicals into the environment, an individual can remove all natural debris, such as rock piles and fallen limbs from the area. Other methods to keep snakes away include cutting back brush and hedges, sealing gaps under doorways and decking, and by using funnel traps that have glue along the edges. Snakes are usually attracted to food sources; if a home or business has a rodent problem, there is almost always a snake issue.