The best way to deal with it* IMHO is to have a long term goal - and a reason why you want to achieve it. The reason should be chosen so that it motivates you to continue with the project. If you cannot think of a good one that will meet that requirement, then consider switching to a project that you can think of a good reason to keep you motivated. Set targets and then break it down into small tasks that are easy to track and achieve (the same as you probably do professionally). Ideally this task list should be somewhere visible, to remind you of it - along with your long term goal/reason.
edit: *it referring to the original complaint. I'm not a Psychiatrist.