AttributeError: module 'fiona' has no attribute 'path' when trying to read a shp file with the geostats_env kerbel #7
|
Environment: Expected result: What I did I am trying to open the 'election.shp file with gpd.read() Error More info access 1.1.9 |
Replies: 1 comment 1 reply
|
I think this has to do with older versions of fiona checking if a path is a zipfile before checking if it is a shapefile. Given the same dependencies below: You should be able to open the shapefile with the code below import fiona
path = elections.get_file_list()[0]
with fiona.open(path) as src:
gdf = gpd.GeoDataFrame.from_features(src, crs=src.crs) This will open the shapefile using fiona instead of geopandas, which bypasses the zipfile check for these versions. You then convert to a projected geodataframe with geopandas. Hopefully this works. no need to change any libraries. |
I think this has to do with older versions of fiona checking if a path is a zipfile before checking if it is a shapefile.
Given the same dependencies below:
shapely 2.0.7
fiona 1.10.1
geopandas 0.13.2
You should be able to open the shapefile with the code below
This will open the shapefile using fiona instead of geopandas, which bypasses the zipfile check for these versions. You then convert to a projected geodataframe with geopandas. Hopefully this works. no need to change any libraries.