Volodyymyr Hryma, 29, or Dorchester Avenue, was in a alley in North Drive, Hounslow, on March 23 when he was wanted by the police.
The officers found a folding pocket knife with a three -inch blade, as well as a small cocaine bag.
Hryma declared himself guilty of possessing an article with Loop and Class A Drugs at a hearing in the Uxbridge magistrates court.
On Monday, April 14, he received a one -year community order that included 300 hours of unpaid work.
He was also ordered to pay the costs of £ 199.