ReligionUtil question

Joined
Jul 5, 2004
Messages
23,562
Location
Canberra, Australia
I am missing something basic because I am getting a basic error :) I am trying to use the function getCityHolyReligions in ReligionUtil.py

Error in PythonErr.log
Code:
Traceback (most recent call last):
  File "BugEventManager", line 361, in _handleDefaultEvent
  File "CvJReligionDecayEventManager", line 62, in onBeginPlayerTurn
  File "CvJReligionDecayGameUtils", line 577, in onBeginPlayerTurn
  File "CvJReligionDecayGameUtils", line 464, in runCityReligionDecay
NameError: global name 'getCityHolyReligions' is not defined

At the start of the code I have
Code:
import ReligionUtil

And the code where it falls over
Code:
        def runCityReligionDecay(self, pCity):

		# Get a list of integer types of the religions in the city
		listCityIntReligions = self.getCityReligionIntList(pCity)
		...

## start added by Dancing Hoskuld ##
		# If holy city religion can not be removed
		# Check each religion in the list to see if this is the holy city for that religion
		if (not g_bHolyCityReligionCanBeRemoved):
			HolyReligionsInThisCity = []
[B]			HolyReligionsInThisCity = getCityHolyReligions(pCity)
[/B]			if not (HolyReligionsInThisCity == None):
				for iReligion in range (HolyReligionsInThisCity.__len__()):
					listCityIntReligions = self.getRemoveIntFromList(listCityIntReligions, HolyReligionsInThisCity[iReligion])

		# Check we still have some religions left that can be removed.
		if (len(listCityIntReligions) == 0):
			return
## end added by Dancing Hoskuld ##
 
You must prefix the function with the name of the module where it appears:

Code:
HolyReligionsInThisCity = [B][COLOR="Red"]ReligionUtil.[/COLOR][/B]getCityHolyReligions(pCity)
 
Top Bottom