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

New fsspec writing breaks for pathlib.Path #1029

Closed
alexander-held opened this issue Nov 16, 2023 · 0 comments · Fixed by #1031
Closed

New fsspec writing breaks for pathlib.Path #1029

alexander-held opened this issue Nov 16, 2023 · 0 comments · Fixed by #1031
Assignees
Labels
bug The problem described is something that must be fixed

Comments

@alexander-held
Copy link
Member

The changes introduced in #1016 (as tested via an installation of uproot5 at 28b0f7b) break the use of pathlib.Path when writing files:

import pathlib
import uproot

uproot.recreate(pathlib.Path("f.root"))

results in

Traceback (most recent call last):
  File "[...]/debug.py", line 4, in <module>
    uproot.recreate(pathlib.Path("f.root"))
  File "[...]/uproot5/src/uproot/writing/writable.py", line 148, in recreate
    sink = _sink_from_path(file_path, **storage_options)
  File "[...]/uproot5/src/uproot/writing/writable.py", line 80, in _sink_from_path
    return uproot.sink.file.FileSink.from_object(file_path_or_object)
  File "[...]/uproot5/src/uproot/sink/file.py", line 55, in from_object
    raise TypeError(
TypeError: writable file can only be created from a file path or an object

    * that has 'read', 'write', 'seek', and 'tell' methods
    * is 'readable() and writable() and seekable()'

We ran into this via nightly tests in pyhf (cc @matthewfeickert) and cabinetry.

The above still works fine in 113c58c.

@alexander-held alexander-held added the bug (unverified) The problem described would be a bug, but needs to be triaged label Nov 16, 2023
@lobis lobis linked a pull request Nov 16, 2023 that will close this issue
@lobis lobis added bug The problem described is something that must be fixed and removed bug (unverified) The problem described would be a bug, but needs to be triaged labels Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The problem described is something that must be fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants