impactlab / eemeter

‼️ MOVED TO https://github.com/openeemeter/eemeter - Core computation engine for the Open Energy Efficiency Meter
https://eemeter.readthedocs.io/
MIT License
25 stars 13 forks source link

TypeError on Location lookups should fail more gracefully #102

Closed philngo closed 8 years ago

philngo commented 8 years ago

For example, if a zipcode is not found, lat and lng should individually be set to None, rather than failing because of a TypeError: 'NoneType' object is not iterable that is raised when zipcode_to_lat_lng returns None.

self.lat, self.lng = zipcode_to_lat_lng(zipcode)

https://github.com/impactlab/eemeter/blob/83f6c466c79cc1e791c121c569846b53969a7879/eemeter/location.py#L289-L299

philngo commented 8 years ago

I'm still not exactly convinced how this should be handled, but for now, I'm handling it by returning None,None instead of None, which generates the type error.