Apologies, I had made a stupid mistake in my rendition of the coding, and it was throwing the whole loop out. Sorry for wasting your time, and thank you for all your help.
I don't see a while loop, the code you posted doesn't have any additional URLs to scrape. It's always better to post the code you are actually running when asking for help. One thing I would suggest with your code, use 3 argument open, open/Three-arg open().
Thank you, yeah that makes complete sense, and I'm not sure why I didn't do that yesterday, to be honest! And thanks for the tip regarding the 3 argument open, I will modify my code to include it. Thanks!