A Worksop man who failed to abide by a court order was carrying cocaine when he was arrested.
Police officers found £40 of the drug on Richard Witts, on August 10, after he bought it earlier in the day.
Sarah Neale, mitigating, said the original order had been imposed on February 15, for 11 thefts of alcohol, and this was his second breach.
She said the bricklayer had begun drinking heavilyafter his partner of 16 years had left him, taking their three children, and he had lost his house and had recently been laid off work.
Witts, 35, of Shrewsbury Road, admitted possessing the Class A drug and breaching the order, when he appeared at Mansfield Magistrates Court, on Saturday.
District judge Jonathan Taaffe acknowledged Witts’ “difficult personal circumstances” and told him they were what saved him from a prison sentence.
The community order was revoked and a new eight week prison sentence was imposed, which will be suspended for 12 months.
Witts was ordered to carry out 80 hours of unpaid work, and pay £85 costs and a £115 government surcharge.