GIScience / orstools-qgis-plugin

Plugin for QGIS with a set of tools to use openrouteservice API´s, based on openstreetmap
https://plugins.qgis.org/plugins/ORStools/
MIT License
92 stars 31 forks source link

'NoneType' object is not iterable #38

Closed ghost closed 6 years ago

ghost commented 6 years ago

Hi Niels, thanks for your work. Some python issues here. Any tips? thanks 2017-12-08T18:35:18 1 Traceback (most recent call last): File "/Users/Peter/.qgis2/python/plugins/OSMtools/osm_tools.py", line 245, in run with open(os.path.join(self.script_dir, "apikey.txt")) as key: AttributeError: 'NoneType' object has no attribute 'path'

2017-12-08T18:45:44 1 Traceback (most recent call last): File "/Users/Peter/.qgis2/python/plugins/OSMtools/osm_tools.py", line 262, in run self.access_anal.iterAnalysis() File "/Users/Peter/.qgis2/python/plugins/OSMtools/osm_tools_access.py", line 382, in iterAnalysis feat_list, isochrone_list = self.accRequest(feat_in_list) TypeError: 'NoneType' object is not iterable

noerw commented 6 years ago

Hi, having the same issue, but more details. This only occurs when processing the response of an isochrone request, using a point layer with 3 or more points as input. I get the error mentioned by @fileradar with 4 points as input, and the following error with 3 points as input. 1 or 2 points works fine.

Traceback (most recent call last):
  File "/home/kreis/.qgis2/python/plugins/OSMtools/osm_tools.py", line 262, in run
    self.access_anal.iterAnalysis()
  File "/home/kreis/.qgis2/python/plugins/OSMtools/osm_tools_access.py", line 394, in iterAnalysis
    self.styleLayer(layer_out, isochrone_list)
  File "/home/kreis/.qgis2/python/plugins/OSMtools/osm_tools_access.py", line 423, in styleLayer
    iso_list.append([iso, colors[cid], str(iso) + legend_suffix])
KeyError: 10
nilsnolde commented 6 years ago

@fileradar Sorry for the really long response time. I'm just getting started again on this, QGIS 3 calling etc. You posted two separate issues.

The first one, I must admit, I didn't encounter yet. Can you please check that you have a file in the /Users/Peter/.qgis2/python/plugins/OSMtools/ directory called apikey.txt and revert?

The second isssue is sorta well known (I think), when there is no correct response from openrouteservice API, e.g. because the point you're analyzing is not close enough to an OSM road segment to be snapped. Can you verify? I'll add error-handling for this though in the next release. I can see how this is annoying.

@noerw This is unrelated to the OP. Please open another issue for this and delete your comment on this issue. FYI, this was already brought to my attention (actually yesterday, funny enough..) and again, never encountered it before. But it's more serious and will be fixed in next release as well (approx. a week).

Anfah commented 6 years ago

Hey,

i have the same problem, do you have a solution yet? I have the file apikey.txt. But it still doesn't work

TypeError: 'NoneType' object is not iterable Traceback (most recent call last): File "C:/Users/Anfahr/.qgis2/python/plugins\OSMtools\osm_tools.py", line 262, in run self.access_anal.iterAnalysis() File "C:/Users/Anfah/.qgis2/python/plugins\OSMtools\osm_tools_access.py", line 382, in iterAnalysis feat_list, isochrone_list = self.accRequest(feat_in_list) TypeError: 'NoneType' object is not iterable

Thank you for your help

Edit: Now it worked once for 10 Points but i tried to do it one more time and i received this error:

2018-01-29T12:11:03 1 Traceback (most recent call last): File "C:/Users/Anfah/.qgis2/python/plugins\OSMtooAnfahm_tools.py", line 262, in run self.access_anal.iterAnalysis() File "C:/Users/Anfah/.qgis2/python/plugins\OSMtools\osm_tools_access.py", line 394, in iterAnalysis self.styleLayer(layer_out, isochrone_list) File "C:/Users/Anfah/.qgis2/python/plugins\OSMtools\osm_tools_access.py", line 423, in styleLayer iso_list.append([iso, colors[cid], str(iso) + legend_suffix]) KeyError: 10

nilsnolde commented 6 years ago

Fixed in qgis2.99-dev branch.. Available from end of week in plugin repo for QGIS 3. Backport to v2 planned, but uncertain timeline..