johnpholden / qgis3redistricter

Redistricting for QGIS v3
GNU General Public License v3.0
5 stars 2 forks source link

Error Creating Plan #4

Closed rsliver66 closed 4 years ago

rsliver66 commented 4 years ago

I used this tool right after seeing the youtube video. I kicked the tires for a couple of hours and it worked great. I need to demo this to others in my local government next Tuesday, and am starting to run into issues. I receive the following error when trying to create a plan. BTW, this is a great tool. Thank you for creating it.

An error has occurred while executing Python code:

KeyError: 'None' Traceback (most recent call last): File "C:/Users/rslivinsky/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis3redistricter-master\StattoRedistrict.py", line 2084, in updatePanelAndSaveParameters self.saveParameters() File "C:/Users/rslivinsky/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis3redistricter-master\StattoRedistrict.py", line 1153, in saveParameters self.totalpop2 = self.totalpop2 + int(feature[self.popfield2]) KeyError: 'None'

Python version: 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] QGIS version: 3.14.0-Pi Pi, 9f7028fd23

Python Path: C:/PROGRA~1/QGIS3~1.14/apps/qgis/./python C:/Users/rslivinsky/AppData/Roaming/QGIS/QGIS3\profiles\default/python C:/Users/rslivinsky/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins C:/PROGRA~1/QGIS3~1.14/apps/qgis/./python/plugins C:\PROGRA~1\QGIS3~1.14\apps\Python37 C:\PROGRA~1\QGIS3~1.14\apps\Python37\Scripts C:\Program Files\QGIS 3.14\bin\python37.zip C:\PROGRA~1\QGIS3~1.14\apps\Python37\DLLs C:\PROGRA~1\QGIS3~1.14\apps\Python37\lib C:\Program Files\QGIS 3.14\bin C:\PROGRA~1\QGIS3~1.14\apps\Python37\lib\site-packages C:\PROGRA~1\QGIS3~1.14\apps\Python37\lib\site-packages\win32 C:\PROGRA~1\QGIS3~1.14\apps\Python37\lib\site-packages\win32\lib C:\PROGRA~1\QGIS3~1.14\apps\Python37\lib\site-packages\Pythonwin C:/Users/rslivinsky/AppData/Roaming/QGIS/QGIS3\profiles\default/python

rsliver66 commented 4 years ago

I believe I discovered the cause of this issue. It is related to the "Optional Second Population Field", as it seem to be pointing to in the error.

The issue is: If you have "None" selected from the drop-down for the "Optional Second Population Field" and have the "Ignore" checkbox on (checked) at the same time, it throws the error. Also choosing "None" and having the "Ignore" checkbox off (unchecked), throws another error (KeyError: 'None') as well.

Current work around is having an actual field selected for "Optional Second Population Field" and having the "Ignore" button checked or unchecked. So basically a user cannot choose "None" from the drop-down or this throws an error. (I guess that is the issue and i should not had been long-winded, but was going through the scenarios while commenting on this.)

Thank you.

johnpholden commented 4 years ago

Yes, that's correct - this has been fixed in the experimental branch, which I expect to migrate over to master this week. Thanks for the feedback (long-winded is honestly very helpful) and hope the plugin works for you!

Thanks John