Details
-
Bug
-
Status: Triage Needed
-
P3
-
Resolution: Unresolved
-
2.25.0
-
None
-
None
Description
It would be nice to support `pathlib.Path`-like objects, as per PEP 519: https://www.python.org/dev/peps/pep-0519/
Currently, the following fail with: TypeError: file_path_prefix must be a string or ValueProvider;got PosixPath('/tmp/pytest-of-forge-00/pytest-0/test_ptransform_beam0/output0.txt') instead
import pathlib path = pathlib.Path('/path/to/home') beam.io.WriteToText(path)
Raised by FileBasedSink:
class FileBasedSink(iobase.Sink): def __init__(self) if not isinstance(file_path_prefix, ((str, unicode), ValueProvider)): raise TypeError(...)
It could be implemented by calling os.fspath(file_path_prefix)