[
https://issues.apache.org/jira/browse/BEAM-11135?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17548970#comment-17548970
]
Danny McCormick commented on BEAM-11135:
----------------------------------------
This issue has been migrated to https://github.com/apache/beam/issues/20580
> 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
> Priority: P3
>
> 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}
> It could be implemented by calling {{os.fspath(file_path_prefix)}}
--
This message was sent by Atlassian Jira
(v8.20.7#820007)