Hot answers tagged error
It looks like SELECT ST_AsText (ST_CENTROID(pol8.geom) AS geom should be SELECT ST_AsText (ST_CENTROID(pol8.geom)) AS geom note the second ) - when in doubt count from left to right +1 for each ( and -1 for each ) if you don't reach 0 at the end then you have missed a bracket.
Add an import arcpy statement as the first line of your script. EDIT: Because you can't import arcpy, you have an installation error.
Check attribute names for special characters and remove them! use the table manager plugin to edit attribute names. I stumbled across the same issues when parsing files and so on. Mostly the problem was a special character like ö, ü, ä, ß and so on. Additionally check your shapefiles for attributes with special characters and eliminate them. Also check ...
Only top voted, non community-wiki answers of a minimum length are eligible