Repository: SciTools/cartopy (language: python)

Issue:
Python 3.12: Shapefile definition is incomplete but successfully downloaded
### Description

<details>
<summary>Code to reproduce:</summary>

```python
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import xarray as xr
import cartopy.crs as ccrs
import cartopy.feature as cfeature


fig = plt.figure(figsize=(12, 6), dpi=350)
ax = plt.axes(projection=ccrs.PlateCarree())
ax.set_extent([-180, 180, 90, -90], crs=ccrs.PlateCarree())
ax.set_title("500hPa Geopotential Heights", fontsize=16)
ax.set_xlabel("Longitude", fontsize=14)
ax.set_ylabel("Latitude", fontsize=14)
gl = ax.gridlines(draw_labels=True)
gl.top_labels = False
gl.right_labels = False
ax.coastlines()
```
</details>

<details>
<summary>Traceback:</summary>

```log
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
File [~/miniforge3/envs/atmos/lib/python3.12/site-packages/IPython/core/formatters.py:340](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/IPython/core/formatters.py:340), in BaseFormatter.__call__(self, obj)
    [338](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/IPython/core/formatters.py:338)     pass
    [339](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/IPython/core/formatters.py:339) else:
--> [340](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/IPython/core/formatters.py:340)     return printer(obj)
    [341](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/IPython/core/formatters.py:341) # Finally look for special method names
    [342](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/IPython/core/formatters.py:342) method = get_real_method(obj, self.print_method)

File [~/miniforge3/envs/atmos/lib/python3.12/site-packages/IPython/core/pylabtools.py:152](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/IPython/core/pylabtools.py:152), in print_figure(fig, fmt, bbox_inches, base64, **kwargs)
    [149](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/IPython/core/pylabtools.py:149)     from matplotlib.backend_bases import FigureCanvasBase
    [150](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/IPython/core/pylabtools.py:150)     FigureCanvasBase(fig)
--> [152](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/IPython/core/pylabtools.py:152) fig.canvas.print_figure(bytes_io, **kw)
    [153](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/IPython/core/pylabtools.py:153) data = bytes_io.getvalue()
    [154](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/IPython/core/pylabtools.py:154) if fmt == 'svg':

File [~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/backend_bases.py:2158](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/backend_bases.py:2158), in FigureCanvasBase.print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, bbox_inches, pad_inches, bbox_extra_artists, backend, **kwargs)
   [2155](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/backend_bases.py:2155)     # we do this instead of `self.figure.draw_without_rendering`
   [2156](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/backend_bases.py:2156)     # so that we can inject the orientation
   [2157](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/backend_bases.py:2157)     with getattr(renderer, "_draw_disabled", nullcontext)():
-> [2158](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/backend_bases.py:2158)         self.figure.draw(renderer)
   [2159](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/backend_bases.py:2159) if bbox_inches:
   [2160](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/backend_bases.py:2160)     if bbox_inches == "tight":

File [~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/artist.py:95](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/artist.py:95), in _finalize_rasterization.<locals>.draw_wrapper(artist, renderer, *args, **kwargs)
     [93](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/artist.py:93) @wraps(draw)
     [94](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/artist.py:94) def draw_wrapper(artist, renderer, *args, **kwargs):
---> [95](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/artist.py:95)     result = draw(artist, renderer, *args, **kwargs)
     [96](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/artist.py:96)     if renderer._rasterizing:
     [97](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/artist.py:97)         renderer.stop_rasterizing()

File [~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/artist.py:72](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/artist.py:72), in allow_rasterization.<locals>.draw_wrapper(artist, renderer)
     [69](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/artist.py:69)     if artist.get_agg_filter() is not None:
     [70](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/artist.py:70)         renderer.start_filter()
---> [72](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/artist.py:72)     return draw(artist, renderer)
     [73](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/artist.py:73) finally:
     [74](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/artist.py:74)     if artist.get_agg_filter() is not None:

File [~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/figure.py:3154](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/figure.py:3154), in Figure.draw(self, renderer)
   [3151](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/figure.py:3151)         # ValueError can occur when resizing a window.
   [3153](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/figure.py:3153) self.patch.draw(renderer)
-> [3154](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/figure.py:3154) mimage._draw_list_compositing_images(
   [3155](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/figure.py:3155)     renderer, self, artists, self.suppressComposite)
   [3157](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/figure.py:3157) for sfig in self.subfigs:
   [3158](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/figure.py:3158)     sfig.draw(renderer)

File [~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/image.py:132](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/image.py:132), in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
    [130](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/image.py:130) if not_composite or not has_images:
    [131](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/image.py:131)     for a in artists:
--> [132](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/image.py:132)         a.draw(renderer)
    [133](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/image.py:133) else:
    [134](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/image.py:134)     # Composite any adjacent images together
    [135](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/image.py:135)     image_group = []

File [~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/artist.py:72](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/artist.py:72), in allow_rasterization.<locals>.draw_wrapper(artist, renderer)
     [69](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/artist.py:69)     if artist.get_agg_filter() is not None:
     [70](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/artist.py:70)         renderer.start_filter()
---> [72](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/artist.py:72)     return draw(artist, renderer)
     [73](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/artist.py:73) finally:
     [74](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/artist.py:74)     if artist.get_agg_filter() is not None:

File [~/miniforge3/envs/atmos/lib/python3.12/site-packages/cartopy/mpl/geoaxes.py:535](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/cartopy/mpl/geoaxes.py:535), in GeoAxes.draw(self, renderer, **kwargs)
    [530](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/cartopy/mpl/geoaxes.py:530)         self.imshow(img, extent=extent, origin=origin,
    [531](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/cartopy/mpl/geoaxes.py:531)                     transform=factory.crs, *factory_args[1:],
    [532](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/cartopy/mpl/geoaxes.py:532)                     **factory_kwargs)
    [533](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/cartopy/mpl/geoaxes.py:533) self._done_img_factory = True
--> [535](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/cartopy/mpl/geoaxes.py:535) return super().draw(renderer=renderer, **kwargs)

File [~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/artist.py:72](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/artist.py:72), in allow_rasterization.<locals>.draw_wrapper(artist, renderer)
     [69](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/artist.py:69)     if artist.get_agg_filter() is not None:
     [70](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/artist.py:70)         renderer.start_filter()
---> [72](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/artist.py:72)     return draw(artist, renderer)
     [73](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/artist.py:73) finally:
     [74](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/artist.py:74)     if artist.get_agg_filter() is not None:

File [~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/axes/_base.py:3070](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/axes/_base.py:3070), in _AxesBase.draw(self, renderer)
   [3067](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/axes/_base.py:3067) if artists_rasterized:
   [3068](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/axes/_base.py:3068)     _draw_rasterized(self.figure, artists_rasterized, renderer)
-> [3070](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/axes/_base.py:3070) mimage._draw_list_compositing_images(
   [3071](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/axes/_base.py:3071)     renderer, self, artists, self.figure.suppressComposite)
   [3073](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/axes/_base.py:3073) renderer.close_group('axes')
   [3074](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/axes/_base.py:3074) self.stale = False

File [~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/image.py:132](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/image.py:132), in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
    [130](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/image.py:130) if not_composite or not has_images:
    [131](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/image.py:131)     for a in artists:
--> [132](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/image.py:132)         a.draw(renderer)
    [133](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/image.py:133) else:
    [134](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/image.py:134)     # Composite any adjacent images together
    [135](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/image.py:135)     image_group = []

File [~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/artist.py:72](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/artist.py:72), in allow_rasterization.<locals>.draw_wrapper(artist, renderer)
     [69](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/artist.py:69)     if artist.get_agg_filter() is not None:
     [70](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/artist.py:70)         renderer.start_filter()
---> [72](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/matplotlib/artist.py:72)     return draw(artist, renderer)
...
--> [138](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/cartopy/io/shapereader.py:138)     raise ValueError("Incomplete shapefile definition "
    [139](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/cartopy/io/shapereader.py:139)                      "in '%s'." % filename)
    [141](https://file+.vscode-resource.vscode-cdn.net/home/yp/repo/ufs-regrid/~/miniforge3/envs/atmos/lib/python3.12/site-packages/cartopy/io/shapereader.py:141) self._fields = self._reader.fields

ValueError: Incomplete shapefile definition in '/home/USER/.local/share/cartopy/shapefiles/natural_earth/physical/ne_110m_coastline.shp'.
```
</details>

This is very confusing. I check the dir `.local/share/cartopy/shapefiles/natural_earth/physical`,

```bash
❯ ls
ne_10m_land.cpg  ne_10m_land.prj  ne_10m_land.shx        ne_110m_coastline.dbf  ne_110m_coastline.shp  ne_50m_coastline.cpg  ne_50m_coastline.prj  ne_50m_coastline.shx
ne_10m_land.dbf  ne_10m_land.shp  ne_110m_coastline.cpg  ne_110m_coastline.prj  ne_110m_coastline.shx  ne_50m_coastline.dbf  ne_50m_coastline.shp
```

the file is right here, how to think about it ?

<details>
<summary>Operating system</summary>

manjaro linux

#### Cartopy version
0.22
#### conda list
```
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
asttokens                 2.4.1              pyhd8ed1ab_0    conda-forge
backports                 1.0                pyhd8ed1ab_3    conda-forge
backports.functools_lru_cache 1.6.5              pyhd8ed1ab_0    conda-forge
bcrypt                    3.2.0           py312h5eee18b_1    defaults
blas                      1.0                    openblas    defaults
bottleneck                1.3.5           py312ha883a20_0    defaults
brotli                    1.0.9                h5eee18b_7    defaults
brotli-bin                1.0.9                h5eee18b_7    defaults
bzip2                     1.0.8                h7b6447c_0    defaults
c-ares                    1.19.1               h5eee18b_0    defaults
ca-certificates           2023.08.22           h06a4308_0    defaults
cartopy                   0.22.0          py312hfb8ada1_1    conda-forge
certifi                   2023.7.22       py312h06a4308_1    defaults
cffi                      1.15.1          py312h5eee18b_3    defaults
cftime                    1.6.2           py312ha883a20_1    defaults
comm                      0.1.4              pyhd8ed1ab_0    conda-forge
contourpy                 1.0.5           py312hdb19cb5_0    defaults
cryptography              41.0.3          py312hdda0065_0    defaults
cycler                    0.11.0             pyhd3eb1b0_0    defaults
cyrus-sasl                2.1.28               h52b45da_1    defaults
dbus                      1.13.18              hb2f20db_0    defaults
debugpy                   1.6.7           py312h6a678d5_0    defaults
decorator                 5.1.1              pyhd8ed1ab_0    conda-forge
exceptiongroup            1.1.3              pyhd8ed1ab_0    conda-forge
executing                 2.0.1              pyhd8ed1ab_0    conda-forge
expat                     2.5.0                h6a678d5_0    defaults
fontconfig                2.14.2               h14ed4e7_0    conda-forge
fonttools                 4.25.0             pyhd3eb1b0_0    defaults
fortls                    2.13.0          py312h7900ff3_2    conda-forge
freetype                  2.12.1               h4a9f257_0    defaults
geos                      3.8.0                he6710b0_0    defaults
giflib                    5.2.1                h5eee18b_3    defaults
glib                      2.69.1               he621ea3_2    defaults
gst-plugins-base          1.14.1               h6a678d5_1    defaults
gstreamer                 1.14.1               h5eee18b_1    defaults
hdf4                      4.2.13               h3ca952b_2    defaults
hdf5                      1.12.1               h2b7332f_3    defaults
icu                       73.1                 h6a678d5_0    defaults
importlib-metadata        6.8.0              pyha770c72_0    conda-forge
importlib_metadata        6.8.0                hd8ed1ab_0    conda-forge
ipykernel                 6.26.0             pyhf8b6a83_0    conda-forge
ipython                   8.17.2             pyh41d4057_0    conda-forge
jedi                      0.19.1             pyhd8ed1ab_0    conda-forge
jpeg                      9e                   h5eee18b_1    defaults
json5                     0.9.6              pyhd3eb1b0_0    defaults
jupyter_client            8.6.0              pyhd8ed1ab_0    conda-forge
jupyter_core              5.5.0           py312h7900ff3_0    conda-forge
kiwisolver                1.4.4           py312h6a678d5_0    defaults
krb5                      1.20.1               h143b758_1    defaults
lcms2                     2.12                 h3be6417_0    defaults
ld_impl_linux-64          2.38                 h1181459_1    defaults
lerc                      3.0                  h295c915_0    defaults
libblas                   3.9.0           16_linux64_openblas    conda-forge
libbrotlicommon           1.0.9                h5eee18b_7    defaults
libbrotlidec              1.0.9                h5eee18b_7    defaults
libbrotlienc              1.0.9                h5eee18b_7    defaults
libcblas                  3.9.0           16_linux64_openblas    conda-forge
libclang                  14.0.6          default_hc6dbbc7_1    defaults
libclang13                14.0.6          default_he11475f_1    defaults
libcups                   2.4.2                h2d74bed_1    defaults
libcurl                   8.4.0                h251f7ec_0    defaults
libdeflate                1.17                 h5eee18b_1    defaults
libedit                   3.1.20221030         h5eee18b_0    defaults
libev                     4.33                 h7f8727e_1    defaults
libexpat                  2.5.0                hcb278e6_1    conda-forge
libffi                    3.4.4                h6a678d5_0    defaults
libgcc-ng                 13.2.0               h807b86a_2    conda-forge
libgfortran-ng            13.2.0               h69a702a_3    conda-forge
libgfortran5              13.2.0               ha4646dd_3    conda-forge
libgomp                   13.2.0               h807b86a_2    conda-forge
liblapack                 3.9.0           16_linux64_openblas    conda-forge
libllvm14                 14.0.6               hdb19cb5_3    defaults
libnetcdf                 4.8.1                h14805e7_4    defaults
libnghttp2                1.57.0               h2d74bed_0    defaults
libnsl                    2.0.0                h5eee18b_0    defaults
libopenblas               0.3.21               h043d6bf_0    defaults
libpng                    1.6.39               h5eee18b_0    defaults
libpq                     12.15                hdbd6064_1    defaults
libsodium                 1.0.18               h7b6447c_0    defaults
libsqlite                 3.44.0               h2797004_0    conda-forge
libssh2                   1.10.0               hdbd6064_2    defaults
libstdcxx-ng              13.2.0               h7e041cc_3    conda-forge
libtiff                   4.5.1                h6a678d5_0    defaults
libuuid                   2.38.1               h0b41bf4_0    conda-forge
libwebp                   1.3.2                h11a3e52_0    defaults
libwebp-base              1.3.2                h5eee18b_0    defaults
libxcb                    1.15                 h7f8727e_0    defaults
libxkbcommon              1.0.1                h5eee18b_1    defaults
libxml2                   2.10.4               hf1b16e4_1    defaults
libzip                    1.8.0                h6ac8c49_1    defaults
libzlib                   1.2.13               hd590300_5    conda-forge
lz4-c                     1.9.4                h6a678d5_0    defaults
matplotlib                3.8.1           py312h7900ff3_0    conda-forge
matplotlib-base           3.8.1           py312he5832f3_0    conda-forge
matplotlib-inline         0.1.6              pyhd8ed1ab_0    conda-forge
munkres                   1.1.4                      py_0    defaults
mysql                     5.7.24               h721c034_2    defaults
ncurses                   6.4                  h6a678d5_0    defaults
nest-asyncio              1.5.8              pyhd8ed1ab_0    conda-forge
netcdf4                   1.6.2           py312h33ae428_0    defaults
numexpr                   2.8.7           py312he7dcb8a_0    defaults
numpy                     1.26.0          py312h2809609_0    defaults
numpy-base                1.26.0          py312he1a6c75_0    defaults
openjpeg                  2.4.0                h3ad879b_0    defaults
openssl                   3.1.4                hd590300_0    conda-forge
packaging                 23.1            py312h06a4308_0    defaults
pandas                    2.1.1           py312h526ad5a_0    defaults
paramiko                  2.8.1              pyhd3eb1b0_0    defaults
parso                     0.8.3              pyhd8ed1ab_0    conda-forge
pcre                      8.45                 h295c915_0    defaults
pexpect                   4.8.0              pyh1a96a4e_2    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pillow                    10.0.1          py312ha6cbd5a_0    defaults
pip                       23.3            py312h06a4308_0    defaults
platformdirs              4.0.0              pyhd8ed1ab_0    conda-forge
ply                       3.11            py312h06a4308_1    defaults
proj                      9.3.0                ha643af7_0    conda-forge
prompt-toolkit            3.0.40             pyha770c72_0    conda-forge
prompt_toolkit            3.0.40               hd8ed1ab_0    conda-forge
psutil                    5.9.5           py312h98912ed_1    conda-forge
ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
pure_eval                 0.2.2              pyhd8ed1ab_0    conda-forge
pycparser                 2.21               pyhd3eb1b0_0    defaults
pygments                  2.16.1             pyhd8ed1ab_0    conda-forge
pynacl                    1.5.0           py312h5eee18b_0    defaults
pyparsing                 3.0.9           py312h06a4308_0    defaults
pyproj                    3.6.1           py312hb113631_4    conda-forge
pyqt                      5.15.10         py312h6a678d5_0    defaults
pyqt5-sip                 12.13.0         py312h5eee18b_0    defaults
pyshp                     2.1.3              pyhd3eb1b0_0    defaults
python                    3.12.0          hab00c5b_0_cpython    conda-forge
python-dateutil           2.8.2              pyhd3eb1b0_0    defaults
python-tzdata             2023.3             pyhd3eb1b0_0    defaults
python_abi                3.12                    4_cp312    conda-forge
pytz                      2023.3.post1    py312h06a4308_0    defaults
pyzmq                     25.1.0          py312h6a678d5_0    defaults
qt-main                   5.15.2              h53bd1ea_10    defaults
readline                  8.2                  h5eee18b_0    defaults
scipy                     1.11.3          py312heda63a1_1    conda-forge
scp                       0.14.1             pyhd3eb1b0_0    defaults
setuptools                68.0.0          py312h06a4308_0    defaults
shapely                   2.0.1           py312h1789038_1    defaults
sip                       6.7.12          py312h6a678d5_0    defaults
six                       1.16.0             pyhd3eb1b0_1    defaults
sqlite                    3.41.2               h5eee18b_0    defaults
stack_data                0.6.2              pyhd8ed1ab_0    conda-forge
tk                        8.6.13          noxft_h4845f30_101    conda-forge
tornado                   6.3.3           py312h98912ed_1    conda-forge
traitlets                 5.13.0             pyhd8ed1ab_0    conda-forge
typing_extensions         4.8.0              pyha770c72_0    conda-forge
tzdata                    2023c                h04d1e81_0    defaults
wcwidth                   0.2.9              pyhd8ed1ab_0    conda-forge
wheel                     0.41.2          py312h06a4308_0    defaults
xarray                    2023.6.0        py312h06a4308_0    defaults
xz                        5.4.2                h5eee18b_0    defaults
zeromq                    4.3.4                h2531618_0    defaults
zipp                      3.17.0             pyhd8ed1ab_0    conda-forge
zlib                      1.2.13               hd590300_5    conda-forge
zstd                      1.5.5                hc292b87_0    defaults
```
</details>

and when I siwtch to python 3.11, it work well.

Thanks for your Reading.
Input filename for shapefile.Reader() should be a string


## Rationale

The input full path name for the function "shapefile.Reader()" should be a string. However, the file name get from e.g. natural_earth() is a pathlib.Path object. This causes an error when reading the data file. 

Change 
        self._reader = reader = shapefile.Reader(filename)
to
        self._reader = reader = shapefile.Reader(str(filename))
on line 136 in io/shapereader.py.



Discussion / hints:
I see that you have pyshp 2.1.3 installed.
I had the same problem, which was caused by cartopy calling pyshp's reader with a Path object, which is not supported in pyshp 2.1.3.
Upgrading pyshp to version 2.3.1 fixed it for me.
Thanks for the diagnosis @aperrin66.  I confirm I can reproduce the error by downgrading pyshp to v2.2.  The error is hard to decipher so I think if we are not going to take #2239 we should bump the minimum pin for pyshp to v2.3.
Thanks for your reply @aperrin66, it helps a lot.
Maybe this should be applied only for PyShp < 2.3.0? GeospatialPython/pyshp#233 added support for path objects
> Maybe this should be applied only for PyShp < 2.3.0? https://github.com/GeospatialPython/pyshp/pull/233 added support for path objects

I think the solution here is for users to upgrade physhp to 2.3.0+? I'm not sure we should be version-gating on this.

Fix patch:
diff --git a/INSTALL b/INSTALL
index 49e93adf4..03609e87a 100644
--- a/INSTALL
+++ b/INSTALL
@@ -69,7 +69,7 @@ Further information about the required dependencies can be found here:
 **Shapely** 1.7.1 or later (https://github.com/shapely/shapely)
     Python package for the manipulation and analysis of planar geometric objects.
 
-**pyshp** 2.1 or later (https://pypi.python.org/pypi/pyshp)
+**pyshp** 2.3 or later (https://pypi.python.org/pypi/pyshp)
     Pure Python read/write support for ESRI Shapefile format.
 
 **pyproj** 3.1.0 or later (https://github.com/pyproj4/pyproj/)
diff --git a/environment.yml b/environment.yml
index 640b1af97..48e394cd3 100644
--- a/environment.yml
+++ b/environment.yml
@@ -11,7 +11,7 @@ dependencies:
   - cython>=0.29.24
   - numpy>=1.21
   - shapely>=1.7.1
-  - pyshp>=2.1
+  - pyshp>=2.3
   - pyproj>=3.1.0
   # The testing label has the proper version of freetype included
   - conda-forge/label/testing::matplotlib-base>=3.4
diff --git a/pyproject.toml b/pyproject.toml
index 0e56f4bae..431b889f7 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -44,7 +44,7 @@ dependencies = [
     "matplotlib>=3.5",
     "shapely>=1.7",
     "packaging>=20",
-    "pyshp>=2.1",
+    "pyshp>=2.3",
     "pyproj>=3.1.0",
 ]
 dynamic = ["version"]


Test patch:
diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml
index 86cac340c..58cd0943b 100644
--- a/.github/workflows/ci-testing.yml
+++ b/.github/workflows/ci-testing.yml
@@ -33,7 +33,7 @@ jobs:
         if: matrix.python-version == '3.9' && matrix.os == 'ubuntu-latest'
         id: minimum-packages
         run: |
-          pip install cython==0.29.24 matplotlib==3.5.3 numpy==1.21 owslib==0.24.1 pyproj==3.1 scipy==1.6.3 shapely==1.7.1
+          pip install cython==0.29.24 matplotlib==3.5.3 numpy==1.21 owslib==0.24.1 pyproj==3.1 scipy==1.6.3 shapely==1.7.1 pyshp==2.3.1
 
       - name: Coverage packages
         id: coverage