yt-project / yt

Main yt repository
http://yt-project.org
Other
465 stars 276 forks source link

BUG: fix loading of AMReX datasets with `~` in the filename #4943

Closed yut23 closed 2 months ago

yut23 commented 2 months ago

PR Summary

One of our group members ran into this today when doing ds = CastroDataset('~/delta_ims/en_20/planar_plt02346'), with an error like:

yt/frontends/boxlib/data_structures.py", line 1116, in _parse_parameter_file
    jobinfo_filename = os.path.join(self.output_dir, self.cparam_filename)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen posixpath>", line 90, in join
  File "<frozen genericpath>", line 164, in _check_arg_types
TypeError: join() argument must be str, bytes, or os.PathLike object, not 'NoneType'

self._lookup_cparam_filepath() was being passed the version of output_dir before having the tilde expanded, and was returning None as ./~/ doesn't exist.

I'm not sure how to add a test for this.

PR Checklist