Skip to content

Cannot use Pathlike objects with from_file #204

@cjosey

Description

@cjosey

The supported arguments to from_file and related is str. Passing a pathlib Path results in:

Traceback (most recent call last):
  File "[path]/process.py", line 8, in <module>
    tape = ENDFtk.tree.Tape.from_file(p)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: from_file(): incompatible function arguments. The following argument types are supported:
    1. (filename: str) -> ENDFtk.tree.Tape

Invoked with: PosixPath('[filename]')

Converting to str works just fine. I have no idea if it is possible to make this more user-friendly with the PyBind11 stuff.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions