Help with python error needed again

And me again.:rolleyes:

I didn´t change named python-files, the are the same as the BtS standard. I didn´t change the .dll either but took the 50civ dll of Better BAT AI but before adding other things in CvEventmanager and so on, I hadn´t errors like this.

The error showed up, when the city screen was opened.

line 2378 in CvMainInterface.py (updateSelectionButtons)
Code:
				for i in range(gc.getNumCorporationInfos()):
					xCoord = xResolution - 242 + (i * 34)
					yCoord = 66
					
					bEnable = True
						
					if (pHeadSelectedCity.isHasCorporation(i)):
						if (pHeadSelectedCity.isHeadquartersByType(i)):
							szTempBuffer = u"%c" %(gc.getCorporationInfo(i).getHeadquarterChar())
							szName = "CorporationHeadquarterDDS" + str(i)
							screen.show( szName )
						else:
							szTempBuffer = u"%c" %(gc.getCorporationInfo(i).getChar())
						szBuffer = szBuffer + szTempBuffer

						for j in range(YieldTypes.NUM_YIELD_TYPES):
							iYield = pHeadSelectedCity.getCorporationYieldByCorporation(j, i)

							if (iYield != 0):
								if ( iYield > 0 ):
									[COLOR="Red"]szTempBuffer = u",%s%d%c" %("+", iYield, gc.getYieldInfo(j).getChar() )[/COLOR]
									szBuffer = szBuffer + szTempBuffer
								else:
									szTempBuffer = u",%s%d%c" %( "", iYield, gc.getYieldInfo(j).getChar() )
									szBuffer = szBuffer + szTempBuffer

line 1233 in CvMainInterface.py (redraw)
Code:
		# Conscript Button Show
		screen.hide( "Conscript" )
		#screen.hide( "Liberate" )
		screen.hide( "AutomateProduction" )
		[COLOR="Red"]screen.hide( "AutomateCitizens" )[/COLOR]

line 954 in CvScreensInterface.py (forceScreenRedraw)
Code:
# Forced redraw
def forceScreenRedraw (argsList):
	# allows overides for mods
	if (CvScreenUtilsInterface.getScreenUtils().forceScreenRedraw(argsList)):
		return
	
	# Main Interface Screen
	if ( argsList[0] == MAIN_INTERFACE ):
		[COLOR="Red"]mainInterface.redraw()[/COLOR]
	elif ( argsList[0] == WORLDBUILDER_SCREEN ):
		worldBuilderScreen.redraw()
	elif ( argsList[0] == WORLDBUILDER_DIPLOMACY_SCREEN ):
		worldBuilderDiplomacyScreen.redraw()
	elif ( argsList[0] == TECH_CHOOSER ):
		techChooser.updateTechRecords(true)

Thank you again for your time and help.
 

Attachments

  • 02 - Fehler beim Stadtansichtsaufruf.JPG
    02 - Fehler beim Stadtansichtsaufruf.JPG
    157.5 KB · Views: 63
I found the possibility to show whitespace signs (tabs and spaces) in notepad++.:blush:

In some python-files they are mixed but I don´t know what the arrows (tabs?) and dots (spaces?) are standing for. Which one are the tabs and which one are the spaces?

I´found the function too where you can define, that tabs should be replaced by spaces. You have to chose a number of spaces. Which would be the correct number?

Perhaps some of these strange errors in files fade away when I´ve corrected the whitespace.
 
For Python it's just best to use the standard Python editor, then you don't get any headaches ;).
Sorry, can't help with the Notepad++ configuration.
But if the game runs, then the indentation should not be a problem, even if spaces and tabs are mixed.

@error: That error is related to XML files.
In most cases it's thrown when you select a unit, and the .kfm of the unit does not match the .nif file.
Because the name of the .nif file is hardcoded into the .kfm, and if it can't find a .nif with that name in the same folder, then such an error pops up.
 
For Python it's just best to use the standard Python editor, then you don't get any headaches ;).
Sorry, can't help with the Notepad++ configuration.

What do you call as the standard Python editor? There are a lot of Python editors, but which one is the best from your point of view?
 
When you download Python, it comes with an editor called "Idle", that's what I mean with standard editor.

From the editors on the list, I tried
- eric, but couldn't compile it
- Eclipse with PyDev plugin, but I like Idle more (but Eclipse has a debugger, Idle has not)
- Geany, because the damn Suse Linux I used at work had due to some reasons Python installed, but not Idle, and I was not able to install it separately; still like Idle more.
- Hap Debugger, but only in connection with Civ. And there it does not seem to be too useful :dunno:
- PyScripter, didn't like it
Think I also tested some others, but don't know...Idle seems to cover most stuff relatively well for me.
But at the end it boils down to "it's a matter of taste". I don't think you can clearly say which is better or which is worse.

Edit: Oh, somehow I had thought this was the quick modding questions thread.
 
AS long as The_J is mistaking this for a general advice thread, I may as well too...

In some python-files they are mixed but I don´t know what the arrows (tabs?) and dots (spaces?) are standing for. Which one are the tabs and which one are the spaces?

The arrows are tabs, the dots spaces. That is why the arrows are more than one character wide (unless you have tabs set to 1, which would be silly).

I´found the function too where you can define, that tabs should be replaced by spaces. You have to chose a number of spaces. Which would be the correct number?

Technically, 8. As far as the Python interpreter is concerned 1 tab = 8 spaces.

But I would recommend against switching tabs to spaces, especially in the context of Civ4's Python. All of the Python that Civ4 came with uses nothing but tabs (unless there are errors in there somewhere that I have not noticed). Therefore, just use tabs. Any time you find spaces, it would be best to change them to tabs to make them indented by the amount they are supposed to be indented.

I have my tabs in Notepad++ set to show be size 4 (as wide as 4 spaces). It is enough that it is easy to tell the level of indentation but not so much that things get indented clear off the page (usually). I also have it showing the indent guide, although that occasionally gets irritating it helps even more (and with it, you could set the tab spacing even lower than 4 and be able to tell the level easily; I may have changed it's style setting to make it even lighter than the default).
 
Thanks to all of you. Yesterday night I checked all the python files I´ve edited so far and erased all spaces and used only tabs for the indentation, since I checked other python files and found only tabs like God-Emporer said.

The size of the tabs are already set as wide as 4 spaces. After that I tried to start a new game and at least the first two times I didn´t have these strange errors in files I didn´t edit.:)

If the error should come up again later I will check the unit arts, but I hope I will not have to do this.

Now I´ve to check the MP-compatibility, but for this, I believe, a new thread would be the best.:D
 
EDIT: I recognized, that every mod is affected by this, so I tried to reboot the computer and it works...sorry.


Me again with a new problem. I´ve the same mod on two computers, all logs in the ini are activated on both computers.

On one computer a get the following error when I start the game, on the other I don´t. I´ve already copied the whole mod from one Computer to the other, with noch effect.:confused::confused:

Any ideas?

Code:
Traceback (most recent call last):
ERR: Call function onEvent failed. Can't find module CvEventInterface
  File "<string>", line 1, in ?
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
  File "<string>", line 52, in load_module
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
  File "CvEventInterface", line 17, in ?
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
  File "<string>", line 52, in load_module
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
  File "BugEventManager", line 102, in ?
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
  File "<string>", line 52, in load_module
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
  File "CvEventManager", line 12, in ?
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
  File "<string>", line 52, in load_module
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
  File "CvScreensInterface", line 3, in ?
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
  File "<string>", line 52, in load_module
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
  File "CvMainInterface", line 9, in ?
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
  File "<string>", line 52, in load_module
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
  File "AlriksEventManager", line 6, in ?
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
  File "<string>", line 52, in load_module
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
  File "CvTechChooser", line 43, in ?
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
  File "<string>", line 52, in load_module
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
  File "GameUtil", line 180, in ?
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
  File "<string>", line 35, in load_module
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
  File "<string>", line 13, in _get_code
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
TypeError
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
: 
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
compile() expected string without null bytes
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
Failed to load python module CvEventInterface.
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
 
@error: That error is related to XML files.
In most cases it's thrown when you select a unit, and the .kfm of the unit does not match the .nif file.
Because the name of the .nif file is hardcoded into the .kfm, and if it can't find a .nif with that name in the same folder, then such an error pops up.

Does the shadernif has to be in the same folder too, although it has a different name?
 
...er...why would you do that o_O?

Like somebody else pointed out, the .kfm just has to find a .nif with the correct name in the same folder, nothing else. You don't even have to use that .nif, it just has to be there. Therefore I'd assume that there's no problem with the general place of any type of .nif file.
 
oh, I don´t want to do that. But I still have the problem of Post #7 and don´t know how to solve. When I copy the mod and rename it, it´s gone for a while. After I started the game several times and start several custom games with different civs, the error occurs sometimes. But it´s more and more often until I get it at every attempt to start or load a game.

When I had reached the point, that the error occurs every time, I tried to delete all new units (single units, UU including the new civs) of my mod. The error didn´t show up. Than I readded them one by one, everytime starting a new custom game to see, if the errors shows up again. I came to the point that I´ve added alle single units and 8 of the 16 new civs. When I added the 9th, the error showed up, so I thought the problem is within this civ and tried the next. Same result. So I tried something else. I let only the first 7 civs in the mod and added the 9th again, which I thought had occured the error before. This time it worked. That brought me to the idea, that the maximum number of civs in a mod could be capped and then I remembered, that I use a 50civs-dll (Better BAT AI) so I assumed, that I´ve to many civs in my mod. As far as I know now there is no reglemantation how many civs you can have in a mod. The 50civ .dll allows you to play with 50 civs in one game instead of just 18 like the standard.

Additional to that, the error now occurs with only 8 of my added civs too. Now it´s only working with seven so far. :mad:

Long story short. I can´t fix the error until now and search for anything that could help me, like the shadernif-thing. :confused:

Oh. I´ve found something that could help in finding the problem. I have added the civs modular, so in the game lobby, the new leaders are not in alphabetical order like the others. They start right after the last leader of the "normal" list and they are sorted by their civ. So f.e. the assyrian leaders are neighbours and it wouldn´t matter if one begins with a and the other with k. The times the error occured later on starting the game the leaders are mixed and not anymore sorted by their civ. Any idea what could cause a behaviour like this?:help:
 
If it was really a problem with the number of civs or units, then Caveman2Cosmos would certainly also have that problem.
While I don't know if or if not they have, downloading and testing would probably give an answer to that suspicion.
 
Thanks for the hint. I tried it and they don´t have the problem. So I remembered the one promotion with the variable [OUR NAME] in some texts and changed them. After that it worked fine. To make sure the error is occured by this I changed it back and tried again. The error is still gone with all 16 added civs...:confused:
 
Top Bottom