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] [Commented] (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:comment-tabpanel&focusedCommentId=17291055#comment-17291055 ] 

Beam JIRA Bot commented on BEAM-11135:
--------------------------------------

This issue is P2 but has been unassigned without any comment for 60 days so it has been labeled "stale-P2". If this issue is still affecting you, we care! Please comment and remove the label. Otherwise, in 14 days the issue will be moved to P3.

Please see https://beam.apache.org/contribute/jira-priorities/ for a detailed explanation of what these priorities mean.


> 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)