gingeleski / odds-portal-scraper

Sports odds and results scraping for Odds Portal (oddsportal.com).
The Unlicense
104 stars 53 forks source link

Could not read environment variable ODDS_PORTAL_USERNAME #12

Closed obtim closed 4 years ago

obtim commented 4 years ago

Got error

(venv) c:\Helper\odds-portal-scraper\predictions>python scraper.py Traceback (most recent call last): File "scraper.py", line 52, in main username = os.environ['ODDS_PORTAL_USERNAME'] File "C:\Users\1\AppData\Local\Programs\Python\Python38\lib\os.py", line 673, in getitem raise KeyError(key) from None KeyError: 'ODDS_PORTAL_USERNAME'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "scraper.py", line 135, in asyncio.get_event_loop().run_until_complete(main()) File "C:\Users\1\AppData\Local\Programs\Python\Python38\lib\asyncio\base_event s.py", line 612, in run_until_complete return future.result() File "scraper.py", line 54, in main raise RuntimeError('Could not read environment variable ODDS_PORTAL_USERNAME ') RuntimeError: Could not read environment variable ODDS_PORTAL_USERNAME

What should I fix ?

gingeleski commented 4 years ago

Ideally there'd be exception handling there to spit out a nice message (my bad), but in this case the error's not too cryptic.

You should just set an environment variable with name ODDS_PORTAL_USERNAME and a value of your actual OddsPortal username via the terminal where you're running this.

https://www.twilio.com/blog/2017/01/how-to-set-environment-variables.html

gingeleski commented 4 years ago

I've updated the documentation to reflect this and help others. Thanks -- Randy