It's easy to get discouraged along the way. In the depths of exam studying I'm sure 90% of my classmates met the criteria for a major depressive episode. And I'm not going to lie; I've shed a few frustrated tears over grades and schoolwork as well.
One reassuring thing about medical school (in Canada, at least) is that once you're in, it seems that the school does everything humanly possible to ensure that you graduate. The years of fighting for A+s are gone -- everything in med school is pass/fail. And if you do fail? No worries, just rewrite that exam until you pass.
That being said, medical school and clerkship are not free of frustrations. There's a lot to learn and sometimes, particularly after a long day at the hospital, not enough time to learn it in. There's plenty of busy ("scut") work that seems counterproductive to your learning (this doesn't end in residency -- but is a lot easier to tolerate when you're receiving a paycheque). And there's a tremendous amount of social stress: being put on the spot in front of your peers and patients, comparing yourself to all of your extraordinary classmates (who are not only geniuses, but also Olympic athletes and in All The Clubs), and living with the uncertainty of not knowing what specialty or city you may be spending the next five years in...or whether you'll come out with a job when all is said and done.
There are two things that I find reassuring in tough times. The first is the old Persian adage (and awesome OK Go song) "this too shall pass". This reminds me that all things, both positive and negative, are temporary. The continual passage of time is the only constant -- and is what carries us through all the many things that are measured by time. 4 years after you start medical school, you graduate; regardless of how tumultuous the course is, all students end up at the same point 4 years later. 26 hours after you start a call shift, you get to go home to sleep; even on a night that feels interminable, the hours keep passing by. Even minor frustrations, like sitting in a seemingly endless traffic jam, can be improved with the reminder that "this too shall pass". The cars won't remain there forever; you know with certainty that they will move on.
The second thing I ask myself is "Is there anything I'd rather be doing?" or, when I'm caught up in wanderlust hearing about friends' backpacking travels, "Would I trade lives with them?". It's tremendously reassuring to me that my answer to these questions has always been a resolute "no".
When I was six years old and kicking up a fuss about practicing piano, my exasperated mother asked whether I wanted to quit piano lessons. I surprised myself by answering an automatic "no!". As much as I hated practicing, I couldn't imagine giving up the ability to play piano (or falling further behind school friends who were already a book ahead of me -- my classmate who played Greensleeves at our first grade concert being the envy of us all).
Again in my second year of medical school, inevitably around exam time, I found myself wondering whether I was doing what I really wanted in life. When I asked myself "Is there anything I'd rather be doing?" it was easy for me to recognize that I wouldn't trade medicine for anything. When I ask myself this question again now, it reminds me of how privileged I am to be in medicine, and reaffirms my gratitude for the life I live in general, making the day-to-day frustrations seem so very inconsequential.
I hope wherever you are in life, you can answer no to these questions too.