The problem seemed weird to me, because I was following the instructions in Townguide's manual  and they produced good results to Waldemar. Besides, Waldemar tried it yesterday in his computer and the maps were rendered correctly, both with mapnik and mapnik2. I thought that the problem was something I changed in the code of AGG renderer, but I went back to the previous revision and the problem was still there.
The problem turned out to be in osm.xml, which I got from: http://svn.openstreetmap.org/applications/rendering/mapnik. Dane Springmeyer had already told me that mapnik2 introduced some changes in the stylesheet, so my stylesheet was outdated. I was also getting deprecation warnings when running mapnik's demos, generate_image.py and nik2img.py:
Deprecation Warning: symbolizer value now an expression, please wrap properly in brackets like "[name]".
My first attempt to eliminate these warnings was to use the upgrade_map_xml utility, as Dane Springmeyer told me. However, it didn't seem to work, because the stylesheet was still the same. So what I did was to replace manually what the warnings were telling me, but I guess I made some mistakes (replacing, for example, in sql queries too).
Searching the web, I found that the output of upgrade_map_xml needed to be printed to a file, as it is displayed in the terminal by default. So the correct usage is:
$ python upgrade_map_xml.py osm.xml > osm.xmlBut what I really did was to print the output in a second file, because python generated the following error:
lxml.etree.XMLSyntaxError: Document is empty, line 1, column 1
And indeed it was empty after issuing the command.