|
if isinstance(fname, str): |
|
if not os.path.exists(fname): |
|
raise Exception("Text file '{}' does not exist".format(fname)) |
|
fid = open(fname, 'rt') |
|
fid_ctx = contextlib.closing(fid) |
|
else: |
|
fid = fname |
|
fid_ctx = contextlib.nullcontext(fid) |
These code assumes that fname is either a string or a file handler. However, in Linux environment, it is pathlib.PosixPath and this scenario is not properly handled here.
modmesh/modmesh/track/dataframe.py
Lines 70 to 77 in bf36b16
These code assumes that fname is either a string or a file handler. However, in Linux environment, it is pathlib.PosixPath and this scenario is not properly handled here.