This isn’t an expert level Python post. It’s mostly about xkcd. I love xkcd – even the posts that are so deeply technical as to be far beyond my experience or understanding. I feel like Randall Munroe really gets people, even though I don’t get him at all. Such is idolization.
I’m trying to figure out a way to have a different random xkcd comic every x-interval time as my wallpaper that will also ideally integrate new comics as they’re uploaded. Initially, I thought I’d found some good, preexisting projects on reddit like this or this, but reading the comments it seems like these projects have a few bugs to work out. Oh well. I’ve at least found and read enough material out there to determine that a python scraper is the best way to go about it.
Onto environment setup!
I found this lovely and very detailed post via pyladies but most of the instructions are quite outdated. (I’m running OS X v 10.11.4 El Capitan, for reference) This post is a loose recollection of what I just finished doing:
1) Install x-code. Turns out that since that pyladies post was first written, all you now need to to to install xcode is type this in your command line:
Hooray, easy peasy!
2) Install Homebrew. What’s homebrew? According to their website, “Homebrew installs the stuff you need that Apple didn’t.” Okay then! The instructions on the pyladies post was outdated again, so I just followed the prompt on the Homebrew site.
So far so good.
3) Check that Python is installed. Python comes with OS X so it was just a matter of typing python –version and seeing if it’s installed. It was. 5.7.10 IIRC.
4) Freak out for half an hour because I can’t figure out how to install pip. Turns out all I needed was a little sudo.
Ironic that it took so long to figure this out considering this whole undertaking was all about getting xkcd comics, one of which is the iconic:
5) Finally (optional), install virtual environment. Easy peasy once again.
And there ya have it! Next to install and debug these xkcd scrapers.