Revolutions python exception
Issue #317
wontfix
Second post includes a savegame:
http://forums.civfanatics.com/showpost.php?p=13974653&postcount=1077 http://forums.civfanatics.com/showpost.php?p=13977328&postcount=1080
Comments (3)
-
reporter -
reporter - changed version to 0.6.0-beta1
I was not able to reproduce this issue in More Naval AI after some hours of automated testing. I will give it another try before 0.6.0-beta.
-
reporter - changed status to wontfix
Revolutions has been marked as experimental in MNAI.
- Log in to comment
What happens in the savegame is that under pressure from rebel groups, someone ceded the control of a city to the Khazad. When the revolution code moves the city to the Khazad, the following exception is triggered:
Traceback (most recent call last): File "BugEventManager", line 358, in _handleDefaultEvent File "Revolution", line 635, in onEndPlayerTurn File "Revolution", line 1078, in updatePlayerRevolution File "Revolution", line 2309, in checkForRevolution File "Revolution", line 2900, in pickRevolutionStyle File "Revolution", line 5008, in makeRevolutionDecision File "Revolution", line 5864, in processRevolution File "RevUtils", line 481, in getHandoverUnitTypes File "PyHelpers", line 1252, in getDescription AttributeError: 'NoneType' object has no attribute 'getDescription'
The code fails in the following line of RevUtils:
if( LOG_DEBUG and not bSilent ) : CvUtil.pyPrint("Revolt - Outdated unit %s (def)"%(PyInfo.UnitInfo(compUnitType).getDescription()))
The problem is that the game is trying to grant a Longbowman to the Khazad, which are not able to build them. When the code reachs that line, PyInfo.UnitInfo(compUnitType) yields none and the exception is shown. Commenting the line out is an acceptable workaround (although it will grant a forbidden unit to the Khazad) but it would be more desirable to fix the Revolutions code to handle cases like this one.