Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when number of parliamentary seats greater than state seats #1

Open
seanlinmt opened this issue Sep 14, 2015 · 5 comments
Open

Comments

@seanlinmt
Copy link
Collaborator

Python errors:

An error has occured while executing Python code:
Traceback (most recent call last):
File "C:/Users/user/.qgis2/python/plugins\Redistricting\redistricting_dock.py", line 297, in live_show
self.lb_recommendation.setText(balancer.recommendation_by_par(str(current_par)))
File "C:/Users/user/.qgis2/python/plugins\Redistricting\balancer.py", line 378, in recommendation_by_par
dun_size_with_min_seats = float(voters_par) / seats_state_min
ZeroDivisionError: float division by zero

Python version:
2.7.4 (default, Apr 6 2013, 19:54:46) [MSC v.1500 32 bit (Intel)]

QGIS version:
2.6.1-Brighton Brighton, e2a51df

Python path: ['C:/PROGRA2/QGISBR1/apps/qgis/./python/plugins\processing', 'C:/Program Files (x86)/JetBrains/PyCharm 3.4.1/pycharm-debug.egg', 'C:/PROGRA2/QGISBR1/apps/qgis/./python', u'C:/Users/user/.qgis2/python', u'C:/Users/user/.qgis2/python/plugins', 'C:/PROGRA2/QGISBR1/apps/qgis/./python/plugins', 'C:\PROGRA2\QGISBR1\bin\python27.zip', 'C:\PROGRA2\QGISBR1\apps\Python27\DLLs', 'C:\PROGRA2\QGISBR1\apps\Python27\lib', 'C:\PROGRA2\QGISBR1\apps\Python27\lib\plat-win', 'C:\PROGRA2\QGISBR1\apps\Python27\lib\lib-tk', 'C:\PROGRA2\QGISBR1\bin', 'C:\PROGRA2\QGISBR1\apps\Python27', 'C:\PROGRA2\QGISBR1\apps\Python27\lib\site-packages', 'C:\PROGRA2\QGISBR1\apps\Python27\lib\site-packages\PIL', 'C:\PROGRA2\QGISBR1\apps\Python27\lib\site-packages\jinja2-2.7.2-py2.7.egg', 'C:\PROGRA2\QGISBR1\apps\Python27\lib\site-packages\markupsafe-0.23-py2.7-win32.egg', 'C:\PROGRA2\QGISBR1\apps\Python27\lib\site-packages\python_dateutil-2.2-py2.7.egg', 'C:\PROGRA2\QGISBR1\apps\Python27\lib\site-packages\pytz-2014.2-py2.7.egg', 'C:\PROGRA2\QGISBR1\apps\Python27\lib\site-packages\win32', 'C:\PROGRA2\QGISBR1\apps\Python27\lib\site-packages\win32\lib', 'C:\PROGRA2\QGISBR1\apps\Python27\lib\site-packages\Pythonwin', 'C:\PROGRA2\QGISBR1\apps\Python27\lib\site-packages\Shapely-1.2.18-py2.7-win32.egg', 'C:\PROGRA2\QGISBR1\apps\Python27\lib\site-packages\six-1.6.1-py2.7.egg', 'C:\PROGRA2\QGISBR1\apps\Python27\lib\site-packages\wx-2.8-msw-unicode', 'C:\Users\user.qgis2\python\plugins\MetaSearch\ext-libs', 'C:/Users/user/.qgis2/python/plugins\Redistricting\packages', 'C:\PROGRA2\QGISBR1\apps\qgis\python\plugins\fTools\tools', 'C:/Users/user/Desktop/QGIS Training/09 KL']

When I select new map:
An error has occured while executing Python code:
Traceback (most recent call last):
File "C:/Users/user/.qgis2/python/plugins\Redistricting\redistricting_dock.py", line 297, in live_show
self.lb_recommendation.setText(balancer.recommendation_by_par(str(current_par)))
File "C:/Users/user/.qgis2/python/plugins\Redistricting\balancer.py", line 378, in recommendation_by_par
dun_size_with_min_seats = float(voters_par) / seats_state_min
ZeroDivisionError: float division by zero

Python version:
2.7.4 (default, Apr 6 2013, 19:54:46) [MSC v.1500 32 bit (Intel)]

QGIS version:
2.6.1-Brighton Brighton, e2a51df

Python path: ['C:/PROGRA2/QGISBR1/apps/qgis/./python/plugins\processing', 'C:/Program Files (x86)/JetBrains/PyCharm 3.4.1/pycharm-debug.egg', 'C:/PROGRA2/QGISBR1/apps/qgis/./python', u'C:/Users/user/.qgis2/python', u'C:/Users/user/.qgis2/python/plugins', 'C:/PROGRA2/QGISBR1/apps/qgis/./python/plugins', 'C:\PROGRA2\QGISBR1\bin\python27.zip', 'C:\PROGRA2\QGISBR1\apps\Python27\DLLs', 'C:\PROGRA2\QGISBR1\apps\Python27\lib', 'C:\PROGRA2\QGISBR1\apps\Python27\lib\plat-win', 'C:\PROGRA2\QGISBR1\apps\Python27\lib\lib-tk', 'C:\PROGRA2\QGISBR1\bin', 'C:\PROGRA2\QGISBR1\apps\Python27', 'C:\PROGRA2\QGISBR1\apps\Python27\lib\site-packages', 'C:\PROGRA2\QGISBR1\apps\Python27\lib\site-packages\PIL', 'C:\PROGRA2\QGISBR1\apps\Python27\lib\site-packages\jinja2-2.7.2-py2.7.egg', 'C:\PROGRA2\QGISBR1\apps\Python27\lib\site-packages\markupsafe-0.23-py2.7-win32.egg', 'C:\PROGRA2\QGISBR1\apps\Python27\lib\site-packages\python_dateutil-2.2-py2.7.egg', 'C:\PROGRA2\QGISBR1\apps\Python27\lib\site-packages\pytz-2014.2-py2.7.egg', 'C:\PROGRA2\QGISBR1\apps\Python27\lib\site-packages\win32', 'C:\PROGRA2\QGISBR1\apps\Python27\lib\site-packages\win32\lib', 'C:\PROGRA2\QGISBR1\apps\Python27\lib\site-packages\Pythonwin', 'C:\PROGRA2\QGISBR1\apps\Python27\lib\site-packages\Shapely-1.2.18-py2.7-win32.egg', 'C:\PROGRA2\QGISBR1\apps\Python27\lib\site-packages\six-1.6.1-py2.7.egg', 'C:\PROGRA2\QGISBR1\apps\Python27\lib\site-packages\wx-2.8-msw-unicode', 'C:\Users\user.qgis2\python\plugins\MetaSearch\ext-libs', 'C:/Users/user/.qgis2/python/plugins\Redistricting\packages', 'C:\PROGRA2\QGISBR1\apps\qgis\python\plugins\fTools\tools', 'C:/Users/user/Desktop/QGIS Training/09 KL']

@PYWONG
Copy link

PYWONG commented Sep 14, 2015

I keyed in the data field of 123/00/04 as follows:
PAR_Baru = KL05,
DUN_BARU = N001.
Python error still active

@seanlinmt
Copy link
Collaborator Author

It looks like the plugin is unable to handle the scenario where the number of parliamentary seats is greater than the number of state seats.

@seanlinmt seanlinmt changed the title NULL value in fields crashes plugin Crash when number of parliamentary seats greater than state seats Sep 23, 2015
@PYWONG
Copy link

PYWONG commented Sep 24, 2015

Sean,

The interim solution is to allow the no. of DUN to equal the PAR. This was
what I did when I was working out the PBT electorate count.

Eg Set PBT 1 as PAR 1, DUN 1. PBT 2 as PAR 2, DUN 2.

Regards,

PY Wong

On Wed, Sep 23, 2015 at 11:34 PM, Sean Lin [email protected] wrote:

It looks like the plugin is unable to handle the scenario where the number
of parliamentary seats is greater than the number of state seats.


Reply to this email directly or view it on GitHub
#1 (comment)
.

@adchin69
Copy link

The basic distribution of seats is that 2 to 4 state seats, = 1 parliament seat.
Hope this helps.

Rgds
Adrian

Sent using CloudMagic Email
[https://cloudmagic.com/k/d/mailapp?ct=pa&cv=7.3.5&pv=4.4.2&source=email_footer_2] On Thu, Sep 24, 2015 at 8:27 AM, PYWONG < [email protected] [[email protected]] > wrote:
Sean,

The interim solution is to allow the no. of DUN to equal the PAR. This was
what I did when I was working out the PBT electorate count.

Eg Set PBT 1 as PAR 1, DUN 1. PBT 2 as PAR 2, DUN 2.

Regards,

PY Wong

On Wed, Sep 23, 2015 at 11:34 PM, Sean Lin [email protected] wrote:

It looks like the plugin is unable to handle the scenario where the number
of parliamentary seats is greater than the number of state seats.


Reply to this email directly or view it on GitHub
#1 (comment)
.


Reply to this email directly or view it on GitHub
[https://github.com//issues/1#issuecomment-142767894] .[https://github.com/notifications/beacon/AK6DbjD4ZkId7kDgjMti2-o-0gRrfbQwks5o0zrbgaJpZM4F8zIP.gif]

@seanlinmt
Copy link
Collaborator Author

Yes. That was the normal assumption. Kuala Lumpur was an edge case that was not taken into account.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants