Best way to review the python docs?

pholtz

King
Joined
May 2, 2006
Messages
672
Location
Seattle
I'm new to python, just read about the self documenting features of the language. I have used the PyDoc help function successfully on self contained modules ( I am using IDLE ). But when I try to use this technique on the Civ 4 files I run into all kinds of problems. Mainly it complains about the imports, files not being available. I thought I would move copies of the modules all into one work folder, but that doesn't work, some of the imports are "invisible", I guess they refer to the C portion of the game? SDK files?

So, I have been unable to use the help function. Is there any way around this problem? What is the best way to get a good review of the various files?

The next step would be when you modify the files, is there anyway to "test" them short of starting up Civ 4?
 
pholtz said:
I'm new to python, just read about the self documenting features of the language. I have used the PyDoc help function successfully on self contained modules ( I am using IDLE ). But when I try to use this technique on the Civ 4 files I run into all kinds of problems. Mainly it complains about the imports, files not being available. I thought I would move copies of the modules all into one work folder, but that doesn't work, some of the imports are "invisible", I guess they refer to the C portion of the game? SDK files?

So, I have been unable to use the help function. Is there any way around this problem? What is the best way to get a good review of the various files?

The next step would be when you modify the files, is there anyway to "test" them short of starting up Civ 4?

I cant answer the documentation question. But as for the 2nd there isn't a way to really test the files outside of Civ4. But python files reload even while the game is running if you modify and save them.

So I typically white everything I want it to do, then start up the game and invariably come up with errors when i try to use my new function. Then I leave the game up while I toggle over and fix the file, save it and toggle back to civ4 and try again. And so on and so on until it works. You dont have to exit and reload to retry something like you do for SDK and XML changes.
 
This might help you somewhat: http://www.sthurlow.com/cvDocs/

The Python include command is non-standard, I think, so I think that's one source of your problem. The other is that they call C++ functions, which compose the core game engine. In a lot of ways, the Python code is a layer on top of the C++. Since it doesn't stand alone, your software won't work :(
 
Those references are sure to help. Thanks. Another similar question. I'm starting to modify files for the first time, and once one of my modified python files didn't work because I didn't have the proper include file. With a python program that would have caused an error pointing out the problem. With Civ4, the game ran without any kind of error reporting, it just didn't work.

Is there anyway to turn on some kind of error reporting when running Civ4 python code?
 
Open up Civilization4.ini ), and change the following entries to the following values:
Code:
HidePythonExceptions = 0
ShowPythonDebugMsgs = 1
LoggingEnabled = 1
MessageLog = 1

Should work.
 
Thank you, I used your info to finally get pydoc help documention on a Civ4 module. See my new thread.
 
Back
Top Bottom