Persistence in the face of frustrations along with an actual enjoyment of creating things with code is what got me through.
Programming seems like it would be a dreadful job for someone who didn't get some satisfaction out of typing code and then watching as your code does stuff. Definitely not for everyone.
In my case, I didn't start out wanting to learn programming. I wanted to create a web site for a business idea I had. To do that, I started learning javascript and python. Pretty soon I realized that I was much more interested in learning more about programming and web development than I was about my business idea and that I'd rather get paid by someone else with a business idea to write some code.