【发布时间】:2019-06-21 05:01:51
【问题描述】:
我正在尝试使用 geopandas 读取 shapefile,为此我使用了gp.read_file
import geopandas as gp
fl="M:/rathore/vic_5km/L2_data/L2_data/DAMSELFISH_distributions.shp"
data=gp.read_file(fl)
我收到以下错误:
TypeError: invalid path: UnparsedPath(path='M:/rathore/vic_5km/L2_data/L2_data/DAMSELFISH_distributions.shp')
问题的追溯是:
----> 1 data=gp.read_file(fl)
c:\python27\lib\site-packages\geopandas\io\file.pyc in read_file(filename, bbox, **kwargs)
75
76 with fiona_env():
---> 77 with reader(path_or_bytes, **kwargs) as features:
78
79 # In a future Fiona release the crs attribute of features will
c:\python27\lib\site-packages\fiona\fiona\env.pyc in wrapper(*args, **kwargs)
395 def wrapper(*args, **kwargs):
396 if local._env:
--> 397 return f(*args, **kwargs)
398 else:
399 if isinstance(args[0], str):
c:\python27\lib\site-packages\fiona\__init__.pyc in open(fp, mode, driver, schema, crs, encoding, layer, vfs, enabled_drivers, crs_wkt, **kwargs)
255 if mode in ('a', 'r'):
256 c = Collection(path, mode, driver=driver, encoding=encoding,
--> 257 layer=layer, enabled_drivers=enabled_drivers, **kwargs)
258 elif mode == 'w':
259 if schema:
c:\python27\lib\site-packages\fiona\fiona\collection.pyc in __init__(self, path, mode, driver, schema, crs, encoding, layer, vsi, archive, enabled_drivers, crs_wkt, ignore_fields, ignore_geometry, **kwargs)
54
55 if not isinstance(path, (string_types, Path)):
---> 56 raise TypeError("invalid path: %r" % path)
57 if not isinstance(mode, string_types) or mode not in ('r', 'w', 'a'):
58 raise TypeError("invalid mode: %r" % mode)
TypeError: invalid path: UnparsedPath(path='M:/rathore/vic_5km/L2_data/L2_data/DAMSELFISH_distributions.shp')
我猜fiona有一些问题,但我不太了解。
我已经在我的系统中安装了fiona 1.8.6 和geopandas 0.5.0 版本。我正在使用 python 2.7
【问题讨论】:
-
驱动器号
M:是指本地网络上的共享文件夹吗? -
M:是因为外置硬盘
标签: python geopandas parse-error fiona