Skip to content

pathlib.PosixPath is passed instead of string #786

@xingularity

Description

@xingularity

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.

Metadata

Metadata

Assignees

Labels

arrayMulti-dimensional array implementationcrashThe system crashes

Type

No fields configured for Bug.

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions