@Orrin-Woodard said in Trouble running command "python oledNewsFlash.py" for project News Flash Headlines:

... any other ideas?

The original oledNewsFlash.py by thepiper (James Liu)
I've made some simple modification. download

Against: /usr/lib/python2.7/site-packages/urllib3/connectionpool.py:843: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised.

import urllib3
urllib3.disable_warnings()

Against: Traceback (most recent call last): File "oledNewsFlash.py", line 81, in <module> latest['author'] File "oledNewsFlash.py", line 18, in WriteHeadline oledExp.write(author) TypeError: argument 1 must be string, not None # writes the authors at the bottom - might overflow back to page 0 if author == None: author = "author n/a" # writes timestamp at the end to ensure it doesn't get overwritten if time == None: time = "timestamp n/a"

It's very frequent on "hacker-news" ;-)

Against: Traceback (most recent call last): File "oledNewsFlash.py", line 72, in <module> latest = newsJson['articles'][0] KeyError: 'articles'

For example on "source" : "bbc-news" ("cnn", "google-news", ...) you should use the "sortBy" : "top" parameter instead of "sortBy" : "latest".

config.json { "X-API-KEY" : "your valid API key", "source" : "cnn", "sortBy" : "top" }

I haven't got any Oled Expansion - so any feedback would be nice. :-)

Thank you,
gf.[0_1502917198127_oledNewsFlash.py](Uploading 100%)