You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Florenz Hollebrandse (Jira)" <ji...@apache.org> on 2021/11/15 13:02:00 UTC
[jira] [Commented] (AVRO-3252) datafile reader fails with BytesIO stream on version 1.11
[ https://issues.apache.org/jira/browse/AVRO-3252?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17443811#comment-17443811 ]
Florenz Hollebrandse commented on AVRO-3252:
--------------------------------------------
This seems to be a change introduced in version 1.11.
Solution probably should be similar to the logic in the {{DataFileWriter}} class, which has a attribute check like this:
{code}
if hasattr(writer, "mode") and "b" not in writer.mode:
{code}
https://github.com/apache/avro/blob/a1fce29d9675b4dd95dfee9db32cc505d0b2227c/lang/py/avro/datafile.py#L171
> datafile reader fails with BytesIO stream on version 1.11
> ---------------------------------------------------------
>
> Key: AVRO-3252
> URL: https://issues.apache.org/jira/browse/AVRO-3252
> Project: Apache Avro
> Issue Type: Bug
> Components: python
> Environment: Windows and Linux
> Python 3.6 to 3.9
> Reporter: Florenz Hollebrandse
> Priority: Major
>
> {code}
> >>> import io
> >>> import avro.datafile
> >>> import avro.io
> >>> data = io.BytesIO()
> >>> datum_reader = avro.io.DatumReader()
> >>> avro.datafile.DataFileReader(data, datum_reader)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "I:\tmpenv\lib\site-packages\avro\datafile.py", line 318, in __init__
> if "b" not in reader.mode:
> AttributeError: '_io.BytesIO' object has no attribute 'mode'
> {code}
--
This message was sent by Atlassian Jira
(v8.20.1#820001)