Skip to content

Cannot read a nc file that contains the diacritic mark tilde (á) in the path #8531

@gitxiaobai667

Description

@gitxiaobai667

What is your issue?

When I use xarray to open a nc file that contains the diacritic mark tilde (á) in the path, I get an error

import xarray as xr
import numpy as np

# Create a new dataset using xarray
data = xr.Dataset(
    {
        "temperature": (("x", "y"), np.random.rand(100, 100))
    },
    coords={
        "x": np.linspace(0, 1, 100),
        "y": np.linspace(0, 1, 100)
    }
)


# I don't know if there are any errors in this step,
# because the actual Chinese text I generated here "example_xarray_谩.nc"
data.to_netcdf('example_xarray_á.nc' )

Running the following one will cause an error

dataset = xr.open_dataset('example_xarray_á.nc')

FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\DELL\\Desktop\\example_xarray_á.nc'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions