The CvInfos::write functions aren't called before the error. So I tried checking on CvUnit::write, and found what seemed to be the problem. I fixed it, and now in stead of the "Failed to compress data" message, I get a seemingly meaningless stream of python errors (These may have been there before, I unknowingly had "Hide python exceptions" on). And the units still don't show up in the city screen.