I am fairly new to Python and therefore my error-solving skills are not much yet developed. I am using Python within a geoprocessing script which is supposed to use ogr (reading/writing shp) and shapely (geometry processing) to dissolve a shapefile with n polygons in it.
To accomplish that step I need the function "cascaded_union" in the shapely.ops module. As soon as I have the import in my script from shapely.ops import cascaded_union I am getting an Error even when I don't use the function anywhere in the script yet. That is why I suppose that this is not a usage rather than a installation/configuration error.
- running an Ubuntu 12.04.3 LTS
- Eclipse with PyDev
- installed shapely via Ubuntu repositories
- included path: /usr/lib/python2.7/dist-packages/shapely
Original exception was: Traceback (most recent call last): File "/home/user/workspace/testproject/dissolve.py", line 3, in <module> from shapely.ops import cascaded_union File "/usr/lib/python2.7/dist-packages/shapely/ops.py", line 6, in <module> from shapely.geos import lgeos File "/usr/lib/python2.7/dist-packages/shapely/geos.py", line 12, in <module> from ctypes.util import find_library File "/usr/lib/python2.7/ctypes/util.py", line 89, in <module> import re, tempfile, errno File "/usr/lib/python2.7/tempfile.py", line 34, in <module> from random import Random as _Random File "/usr/lib/python2.7/dist-packages/numpy/random/__init__.py", line 90, in <module> ranf = random = sample = random_sample NameError: name 'random_sample' is not defined
Content of dissolve.py:
from shapely.ops import cascaded_union
The auto completion of the import works. So the packages are recognized I guess.
I am thankful for any help/suggestions.