pysal.open
returns a shape "file" object, not shapes.
To get the shapes out you need to iterate over the file, or call the file's read method, which returns a list of shapes. This will return a list even if there is only 1 shape in your file. get_polygon_point_intersect
takes exactly 1 polygon and 1 point, so you'd need to call it for each point/polygon you want to compare.
point_file = pysal.open('points.shp')
polygon_file = pysal.open('polygons.shp')
# .read with no arguments returns a list of all shapes in the file.
polygons = polygon_file.read()
for polygon in polygons:
# for x in shapefile: iterates over each shape in the file.
for point in point_file:
if get_polygon_point_intersect(polygon, point):
print point, 'intersects with', polygon
There are other perhaps more efficient ways of doing this as well. See the pysal.cg.locators
for more information.
*The above code is untested and for example purposes only.