nens / threedigrid

grid administration for 3Di models
Other
9 stars 0 forks source link

Support str, bytes and file-like objects in GridH5Admin, GridH5ResultAdmin #183

Open arjanverkerk opened 1 year ago

arjanverkerk commented 1 year ago

On windows, there can be issues with h5py and international characters in the file path. This can be worked around by passing bytes: h5py.File(file_path.encode('utf-8')) or a file-like object: h5py.File(open(file_path, 'rb')).

However, in threedigrid a bytes file path is not possible here (because the startswith argument is a str): https://github.com/nens/threedigrid/blob/2.0.1/threedigrid/admin/gridadmin.py#L61

And here only str is possible, for more or less the same reason: https://github.com/nens/threedigrid/blob/2.0.1/threedigrid/admin/gridresultadmin.py#L64

If threedigrid can be made to accept file-like objects and bytes, users can handle their windows issues themselves.