You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Harsh J (JIRA)" <ji...@apache.org> on 2013/05/06 07:32:15 UTC
[jira] [Commented] (AVRO-959) python implementation calls seek on
input, unable to read avros from a stream
[ https://issues.apache.org/jira/browse/AVRO-959?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13649531#comment-13649531 ]
Harsh J commented on AVRO-959:
------------------------------
It is possible to seek the standard input, iff a file is used as one:
{code}
➜ ~ cat foo.py
import sys
inp = sys.stdin
inp.seek(0)
➜ ~ cat foo.py | python foo.py
Traceback (most recent call last):
File "foo.py", line 4, in <module>
inp.seek(0)
IOError: [Errno 29] Illegal seek
➜ ~ python foo.py < foo.py
➜ ~ python foo.py <(cat foo.py)
➜ ~
{code}
We could probably document and leverage this?
> python implementation calls seek on input, unable to read avros from a stream
> -----------------------------------------------------------------------------
>
> Key: AVRO-959
> URL: https://issues.apache.org/jira/browse/AVRO-959
> Project: Avro
> Issue Type: Bug
> Components: python
> Affects Versions: 1.6.1
> Reporter: Sean Jensen-Grey
>
> The python implementation of Avro calls seek on the input file handle which precludes it from being a stream (stdin, hadoop streaming, etc)
> {code}
> ack -a -i seek
> src/avro/datafile.py
> 109: # seek to the end of the file and prepare for writing
> 110: writer.seek(0, 2)
> 190: DataFileReader.seek(long). Forces the end of the current block,
> 261: self.reader.seek(0, 2)
> 263: self.reader.seek(remember_pos)
> 270: # seek to the beginning of the file to get magic block
> 271: self.reader.seek(0, 0)
> 316: return True. Otherwise, seek back to where we started and return False.
> 320: self.reader.seek(-SYNC_SIZE, 1)
> src/avro/io.py
> 148: reader is a Python object on which we can call read, seek, and tell.
> 267: self.reader.seek(self.reader.tell() + n)
> src/avro/txipc.py
> 217: request.content.seek(0, 0)
> test/test_io.py
> 137: writer.seek(0)
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira