You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "Beam JIRA Bot (Jira)" <ji...@apache.org> on 2021/02/25 17:19:00 UTC
[jira] [Updated] (BEAM-11135) pathlib.Path, PathLike and __fspath__
support (PEP 519)
[ https://issues.apache.org/jira/browse/BEAM-11135?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Beam JIRA Bot updated BEAM-11135:
---------------------------------
Labels: stale-P2 (was: )
> 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: P2
> Labels: stale-P2
>
> 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.3.4#803005)