RogerBacon
King
- Joined
- Nov 16, 2003
- Messages
- 649
Here's the error:
===========================================
Traceback (most recent call last):
File "CvEventInterface", line 23, in onEvent
File "CvCustomEventManager", line 45, in handleEvent
File "CvEventManager", line 177, in handleEvent
File "CvCustomEventManager", line 108, in onBeginGameTurn
File "Shogun", line 28, in onBeginGameTurn
RuntimeError: unidentifiable C++ exception
ERR: Python function onEvent failed, module CvEventInterface
============================================
Here's the relevant part of my "Shogun.py" file from the beginning:
The line that causes the problem is:
myCivName = pPlayer.getCivilizationDescriptionKey()
Now, the code works fine but it gives me that error. I know it's working because the log shows it prints "TXT_KEY_CIV_JAPAN_DESC" and the rest of the script continues to execute.
In my customEventInterface.py I have:
If I change it to:
sho.onBeginGameTurn(self, argsList)
then I get the error message:
onBeginGameTurn() takes exactly 2 arguments (3 given)
Does anyone know what is causing this error?
Roger Bacon
===========================================
Traceback (most recent call last):
File "CvEventInterface", line 23, in onEvent
File "CvCustomEventManager", line 45, in handleEvent
File "CvEventManager", line 177, in handleEvent
File "CvCustomEventManager", line 108, in onBeginGameTurn
File "Shogun", line 28, in onBeginGameTurn
RuntimeError: unidentifiable C++ exception
ERR: Python function onEvent failed, module CvEventInterface
============================================
Here's the relevant part of my "Shogun.py" file from the beginning:
Code:
from CvPythonExtensions import *
import CvUtil
import PyHelpers # LOQ
import Popup as PyPopup
import pickle # LOQ 2005-10-12
# globals
gc = CyGlobalContext()
PyPlayer = PyHelpers.PyPlayer # LOQ
PyInfo = PyHelpers.PyInfo
theGame = CyGame()
theGameSpeedInfo = CvGameSpeedInfo()
class Shogun:
def onBeginGameTurn(self, argsList):
'Called at the beginning of a game turn'
iPlayer = argsList
for iPlayer in range(gc.getMAX_PLAYERS()):
pPlayer = gc.getPlayer(iPlayer)
# change this numer to alter the chance of getting an experiece point. A unit has 1 out of [this value] chance of getting an exp each turn
# for example, if you set it to 10 a unit has a 1 in 10 chance of getting an exp point each turn.
#Setting it to 1 means units gain an exp point every turn (1 in 1 chance)
barracksChance = 12
drydockChance = 12
# Units with exp higher than this number will not gain any more exp from a barracks or drydock.
barracksMaxExp = 8
drydockMaxExp = 8
myCivName = pPlayer.getCivilizationDescriptionKey()
message1 = myCivName
#CyInterface().addImmediateMessage(message1,"")
CvUtil.pyPrint(message1)
The line that causes the problem is:
myCivName = pPlayer.getCivilizationDescriptionKey()
Now, the code works fine but it gives me that error. I know it's working because the log shows it prints "TXT_KEY_CIV_JAPAN_DESC" and the rest of the script continues to execute.
In my customEventInterface.py I have:
Code:
def onBeginGameTurn(self, argsList):
'Called at the beginning of the end of each turn'
self.parent.onBeginGameTurn(self, argsList);
#INSERT MODS
sho.onBeginGameTurn(argsList)
If I change it to:
sho.onBeginGameTurn(self, argsList)
then I get the error message:
onBeginGameTurn() takes exactly 2 arguments (3 given)
Does anyone know what is causing this error?
Roger Bacon