A Port Glasgow man has been spared jail time after he was caught carrying a blade in the town.