Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File should accept both string and pathlib.Path #82

Open
erikfrojdh opened this issue Jul 16, 2024 · 0 comments
Open

File should accept both string and pathlib.Path #82

erikfrojdh opened this issue Jul 16, 2024 · 0 comments
Assignees

Comments

@erikfrojdh
Copy link
Member

from pathlib import Path

fpath = Path('/Users/erik/data/cluster/cu_half_speed_master_4.json')
f = File(fpath, 'r')

results in:

Traceback (most recent call last):
  File "/Users/erik/software/aare/src/python/example/scratch.py", line 6, in <module>
    f = File(fpath, 'r')
        ^^^^^^^^^^^^^^^^
TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
    1. _aare.File(arg0: _aare.Path)
    2. _aare.File(arg0: _aare.Path, arg1: str)
    3. _aare.File(arg0: _aare.Path, arg1: str, arg2: aare::FileConfig)

Invoked with: PosixPath('/Users/erik/data/cluster/cu_half_speed_master_4.json'), 'r'

Current workaround

f = File(fpath.as_posix(), 'r')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants