Getting an error with generate_tiles.py

So I’m trying to generate tiles for the city I live in, and the tile generation goes fine for a bit, generates some stuff, and then it gives me this error:

Cmhapel Hill essage type 0x32 arrived from server while idle
:E xception in thread Thread-1:
Traceback (most recent call last):
File “C:\Python26\lib\threading.py”, line 532, in __bootstrap_inner
self.run()
File “C:\Python26\lib\threading.py”, line 484, in run
self.__target(*self.__args, **self.__kwargs)
File “C:\mapnik-0.7.1\generate_tiles.py”, line 110, in loop
self.render_tile(tile_uri, x, y, z)
File “C:\mapnik-0.7.1\generate_tiles.py”, line 92, in render_tile
mapnik.render(self.m, im)
RuntimeError: PSQL error:
ERROR: invalid message format
ERROR: invalid message format
Full sql was: ‘SELECT AsBinary(“way”) AS geom,“barrier”,“highway”,“man_made”,“na
tural”,“power”,“power_source”,“railway” from
(select *
from planet_osm_point
where aeroway in (‘airport’,‘aerodrome’)
or barrier in (‘bollard’,‘gate’,‘lift_gate’)
or highway in (‘mini_roundabout’,‘gate’)
or man_made in (‘lighthouse’,‘power_wind’,‘windmill’,‘mast’)
or (power=‘generator’ and power_source=‘wind’)
or “natural” in (‘peak’,‘spring’,‘tree’,‘cave_entrance’)
or railway=‘level_crossing’
) as symbols WHERE “way” && SetSRID(‘BOX3D(-8799277.822132919 4287047.1684
02395,-8798666.325906638 4287658.664628676)’::box3d, 900913)’

18message type 0x54 arrived from server while idle
message type 0x43 arrived from server while idle
message type 0x5a arrived from server while idle
message type 0x31 arrived from server while idle
message type 0x32 arrived from server while idle
message type 0x54 arrived from server while idle
ERROR: invalid message format
ERROR: invalid message format
message type 0x5a arrived from server while idle
message type 0x32 arrived from server while idle
message type 0x54 arrived from server while idle
message type 0x43 arrived from server while idle
message type 0x5a arrived from server while idle

and then it kicks back to the command prompt and stops executing
Now, I’ve got no experience with python, but I think there’s something screwy with the query it was trying to execute?
I tried generating tiles for a smaller section of my town, and I think it went fine. There weren’t any errors while it was generating tiles, but it didn’t kick me back to the command prompt when it looked like it was finished.

Any ideas? I’d greatly appreciate any advice.

Thanks!