[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Adonthell-devel] Weird Python error

From: ksterker
Subject: [Adonthell-devel] Weird Python error
Date: Wed, 21 Apr 2004 14:17:48 +0200

Since I still can't commit, I'll try to keep you at least informed over what I 
did (in the hope to motivate you guys too :-))

I have fixed some bugs in the flat/diskio code. I was really amazed, as all the 
tests I made ran successfully, but there were still a couple of bugs left. 
Still, event loading / saving is not entirely working, as I got sidetracked ...

As I became bored of looking at the save file with hexdump, I chose to write a 
little python script that would print the save contents in human readable form. 
That should have been no problem, as the file format contains enough 
meta-information to be parsed without knowledge of the actual content. I wrote 
a nice typemap for flat::next, to encode the values from the file with their 
proper python type, and it nearly worked. Here's the interesting portion of the 
code, without fancy formatting:

   def print_record (record):
       type, value, size, name = (None)
       while type != -1:
           print name, type, size, str (value)
           if type == base.flat.T_FLAT:
               print_record (value)
           type, value, size, name = (None)

That's all. However, the second time the function returns from a nested record, 
I get an error like:

'flat has no member called flat_next in method
   def next(args*): return _base.flat_next (args*)'

As it seems, '_base', which is the C++ base module has been changed to point to 
record (which is of type flat and does indeed have no flat_next member)!

That is about the weirdest thing I've ever seen, and I cannot really imagine 
what is causing this. Cost me half my sleep too ;-). Anyway, I'll probably 
leave that and fix event loading rather with the help of hexdump. But I am 
really curious about what goes wrong ... once I can commit, you may give it a 
try. Seeing it in action might yield more clues than just reading about it.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]