Etienne POT created BEAM-11135:
----------------------------------
Summary: pathlib.Path, PathLike and __fspath__ support (PEP 519)
Key: BEAM-11135
URL: https://issues.apache.org/jira/browse/BEAM-11135
Project: Beam
Issue Type: Bug
Components: io-py-avro, io-py-files, io-py-parquet, io-py-tfrecord
Affects Versions: 2.25.0
Reporter: Etienne POT
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}}
{code:python}
import pathlib
path = pathlib.Path('/path/to/home')
beam.io.WriteToText(path)
{code}
Raised by FileBasedSink:
{code:python}
class FileBasedSink(iobase.Sink):
def __init__(self)
if not isinstance(file_path_prefix, ((str, unicode), ValueProvider)):
raise TypeError(...)
{code}
{code:python}
class FileBasedSink(iobase.Sink):
def __init__(self)
if not isinstance(file_path_prefix, ((str, unicode), ValueProvider)):
raise TypeError(...)
{code}
```
```
--
This message was sent by Atlassian Jira
(v8.3.4#803005)